no message

This commit is contained in:
A1300399510
2024-02-18 20:19:03 +08:00
parent 11ab23f6d3
commit 50c4074182
165 changed files with 18003 additions and 13290 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/parser",
"version": "7.23.6",
"version": "7.23.9",
"description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser",

View 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 };

View File

@@ -0,0 +1,47 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/schema"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"keywords": [
"head",
"meta tags",
"types"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.10"
},
"devDependencies": {
"packrup": "^0.1.0"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "@unhead/dom",
"type": "module",
"version": "1.8.9",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
@@ -29,8 +29,8 @@
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.9",
"@unhead/shared": "1.8.9"
"@unhead/schema": "1.8.10",
"@unhead/shared": "1.8.10"
},
"scripts": {
"build": "unbuild .",

View File

@@ -1,7 +1,7 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.9",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
@@ -34,7 +34,7 @@
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.9"
"@unhead/schema": "1.8.10"
},
"devDependencies": {
"packrup": "^0.1.0"

View File

@@ -43,7 +43,7 @@ function tagToString(tag) {
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
}
function ssrRenderTags(tags) {
function ssrRenderTags(tags, options) {
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
for (const tag of tags) {
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
@@ -52,16 +52,17 @@ function ssrRenderTags(tags) {
}
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
}
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
return {
headTags: schema.tags.head.join("\n"),
bodyTags: schema.tags.bodyClose.join("\n"),
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
headTags: schema.tags.head.join(lineBreaks),
bodyTags: schema.tags.bodyClose.join(lineBreaks),
bodyTagsOpen: schema.tags.bodyOpen.join(lineBreaks),
htmlAttrs: propsToString(schema.htmlAttrs),
bodyAttrs: propsToString(schema.bodyAttrs)
};
}
async function renderSSRHead(head) {
async function renderSSRHead(head, options) {
const beforeRenderCtx = { shouldRender: true };
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
if (!beforeRenderCtx.shouldRender) {
@@ -75,7 +76,7 @@ async function renderSSRHead(head) {
}
const ctx = { tags: await head.resolveTags() };
await head.hooks.callHook("ssr:render", ctx);
const html = ssrRenderTags(ctx.tags);
const html = ssrRenderTags(ctx.tags, options);
const renderCtx = { tags: ctx.tags, html };
await head.hooks.callHook("ssr:rendered", renderCtx);
return renderCtx.html;

View 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 };

View File

@@ -0,0 +1,47 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/schema"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"keywords": [
"head",
"meta tags",
"types"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.10"
},
"devDependencies": {
"packrup": "^0.1.0"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "@unhead/ssr",
"type": "module",
"version": "1.8.9",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
@@ -29,8 +29,8 @@
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.9",
"@unhead/shared": "1.8.9"
"@unhead/schema": "1.8.10",
"@unhead/shared": "1.8.10"
},
"scripts": {
"build": "unbuild .",

View File

@@ -1,3 +1,8 @@
/**
* @vue/compiler-core v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -1509,7 +1514,7 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
if (includeAll || isRefed && !isLocal) {
onIdentifier(node, parent, parentStack, isRefed, isLocal);
}
} else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
} else if (node.type === "ObjectProperty" && (parent == null ? void 0 : parent.type) === "ObjectPattern") {
node.inPattern = true;
} else if (isFunctionType(node)) {
if (node.scopeIds) {
@@ -2562,7 +2567,7 @@ function onCloseTag(el, end, isImplied = false) {
}
{
const props = el.props;
if (isCompatEnabled(
if (!tokenizer.inSFCRoot && isCompatEnabled(
"COMPILER_NATIVE_TEMPLATE",
currentOptions
) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -3171,8 +3176,7 @@ function createTransformContext(root, {
}
context.parent.children.splice(removalIndex, 1);
},
onNodeRemoved: () => {
},
onNodeRemoved: shared.NOOP,
addIdentifiers(exp) {
{
if (shared.isString(exp)) {

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-core",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -17,6 +17,7 @@
"development": "./dist/compiler-core.cjs.js",
"default": "./dist/compiler-core.cjs.prod.js"
},
"module": "./dist/compiler-core.esm-bundler.js",
"import": "./dist/compiler-core.esm-bundler.js",
"require": "./index.js"
},
@@ -49,7 +50,7 @@
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2",
"@vue/shared": "3.4.5"
"@vue/shared": "3.4.15"
},
"devDependencies": {
"@babel/types": "^7.23.6"

View File

@@ -1,3 +1,8 @@
/**
* @vue/compiler-dom v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-dom",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
@@ -19,6 +19,7 @@
"development": "./dist/compiler-dom.cjs.js",
"default": "./dist/compiler-dom.cjs.prod.js"
},
"module": "./dist/compiler-dom.esm-bundler.js",
"import": "./dist/compiler-dom.esm-bundler.js",
"require": "./index.js"
},
@@ -50,7 +51,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.4.5",
"@vue/compiler-core": "3.4.5"
"@vue/shared": "3.4.15",
"@vue/compiler-core": "3.4.15"
}
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/compiler-ssr v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-ssr",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.4.5",
"@vue/compiler-dom": "3.4.5"
"@vue/shared": "3.4.15",
"@vue/compiler-dom": "3.4.15"
}
}

View File

@@ -0,0 +1,548 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
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;

View File

@@ -0,0 +1,46 @@
{
"name": "@vue/shared",
"version": "3.4.5",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/runtime-core v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -102,7 +107,7 @@ function handleError(err, instance, type, throwInDev = true) {
if (instance) {
let cur = instance.parent;
const exposedInstance = instance.proxy;
const errorInfo = `https://vuejs.org/errors/#runtime-${type}`;
const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
while (cur) {
const errorCapturedHooks = cur.ec;
if (errorCapturedHooks) {
@@ -214,14 +219,15 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
}
function flushPostFlushCbs(seen) {
if (pendingPostFlushCbs.length) {
const deduped = [...new Set(pendingPostFlushCbs)];
const deduped = [...new Set(pendingPostFlushCbs)].sort(
(a, b) => getId(a) - getId(b)
);
pendingPostFlushCbs.length = 0;
if (activePostFlushCbs) {
activePostFlushCbs.push(...deduped);
return;
}
activePostFlushCbs = deduped;
activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
activePostFlushCbs[postFlushIndex]();
}
@@ -509,7 +515,7 @@ function renderComponentRoot(instance) {
setCurrentRenderingInstance(prev);
return result;
}
function filterSingleRoot(children) {
function filterSingleRoot(children, recurse = true) {
let singleRoot;
for (let i = 0; i < children.length; i++) {
const child = children[i];
@@ -603,8 +609,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
return false;
}
function updateHOCHostEl({ vnode, parent }, el) {
if (!el)
return;
while (parent) {
const root = parent.subTree;
if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -687,6 +691,10 @@ const SuspenseImpl = {
rendererInternals
);
} else {
if (parentSuspense && parentSuspense.deps > 0) {
n2.suspense = n1.suspense;
return;
}
patchSuspense(
n1,
n2,
@@ -935,6 +943,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
}
}
const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
const initialAnchor = anchor;
const suspense = {
vnode,
parent: parentSuspense,
@@ -942,7 +951,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
namespace,
container,
hiddenContainer,
anchor,
deps: 0,
pendingId: suspenseId++,
timeout: typeof timeout === "number" ? timeout : -1,
@@ -973,20 +981,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
move(
pendingBranch,
container2,
next(activeBranch),
anchor === initialAnchor ? next(activeBranch) : anchor,
0
);
queuePostFlushCb(effects);
}
};
}
let { anchor: anchor2 } = suspense;
if (activeBranch) {
anchor2 = next(activeBranch);
if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
anchor = next(activeBranch);
}
unmount(activeBranch, parentComponent2, suspense, true);
}
if (!delayEnter) {
move(pendingBranch, container2, anchor2, 0);
move(pendingBranch, container2, anchor, 0);
}
}
setActiveBranch(suspense, pendingBranch);
@@ -1204,7 +1213,12 @@ function queueEffectWithSuspense(fn, suspense) {
function setActiveBranch(suspense, branch) {
suspense.activeBranch = branch;
const { vnode, parentComponent } = suspense;
const el = vnode.el = branch.el;
let el = branch.el;
while (!el && branch.component) {
branch = branch.component.subTree;
el = branch.el;
}
vnode.el = el;
if (parentComponent && parentComponent.subTree === vnode) {
parentComponent.vnode.el = el;
updateHOCHostEl(parentComponent, el);
@@ -1405,14 +1419,9 @@ function instanceWatch(source, value, options) {
cb = value.handler;
options = value;
}
const cur = currentInstance;
setCurrentInstance(this);
const reset = setCurrentInstance(this);
const res = doWatch(getter, cb.bind(publicThis), options);
if (cur) {
setCurrentInstance(cur);
} else {
unsetCurrentInstance();
}
reset();
return res;
}
function createPathGetter(ctx, path) {
@@ -1459,11 +1468,10 @@ function traverse(value, depth, currentDepth = 0, seen) {
}
function withDirectives(vnode, directives) {
const internalInstance = currentRenderingInstance;
if (internalInstance === null) {
if (currentRenderingInstance === null) {
return vnode;
}
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
const bindings = vnode.dirs || (vnode.dirs = []);
for (let i = 0; i < directives.length; i++) {
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2219,9 +2227,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
return;
}
reactivity.pauseTracking();
setCurrentInstance(target);
const reset = setCurrentInstance(target);
const res = callWithAsyncErrorHandling(hook, target, type, args);
unsetCurrentInstance();
reset();
reactivity.resetTracking();
return res;
});
@@ -2527,50 +2535,6 @@ function useSlots() {
function useAttrs() {
return getContext().attrs;
}
function useModel(props, name, options = shared.EMPTY_OBJ) {
const i = getCurrentInstance();
const camelizedName = shared.camelize(name);
const hyphenatedName = shared.hyphenate(name);
const res = reactivity.customRef((track, trigger) => {
let localValue;
watchSyncEffect(() => {
const propValue = props[name];
if (shared.hasChanged(localValue, propValue)) {
localValue = propValue;
trigger();
}
});
return {
get() {
track();
return options.get ? options.get(localValue) : localValue;
},
set(value) {
const rawProps = i.vnode.props;
if (!(rawProps && // check if parent has passed v-model
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
localValue = value;
trigger();
}
i.emit(`update:${name}`, options.set ? options.set(value) : value);
}
};
});
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
res[Symbol.iterator] = () => {
let i2 = 0;
return {
next() {
if (i2 < 2) {
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
} else {
return { done: true };
}
}
};
};
return res;
}
function getContext() {
const i = getCurrentInstance();
return i.setupContext || (i.setupContext = createSetupContext(i));
@@ -3279,12 +3243,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
if (key in propsDefaults) {
value = propsDefaults[key];
} else {
setCurrentInstance(instance);
const reset = setCurrentInstance(instance);
value = propsDefaults[key] = defaultValue.call(
null,
props
);
unsetCurrentInstance();
reset();
}
} else {
value = defaultValue;
@@ -3507,9 +3471,10 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
} else {
const _isString = shared.isString(ref);
const _isRef = reactivity.isRef(ref);
const isVFor = rawRef.f;
if (_isString || _isRef) {
const doSet = () => {
if (rawRef.f) {
if (isVFor) {
const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
if (isUnmount) {
shared.isArray(existing) && shared.remove(existing, refValue);
@@ -3540,11 +3505,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
refs[rawRef.k] = value;
} else ;
};
if (value) {
if (isUnmount || isVFor) {
doSet();
} else {
doSet.id = -1;
queuePostRenderEffect(doSet, parentSuspense);
} else {
doSet();
}
}
}
@@ -4456,7 +4421,11 @@ function baseCreateRenderer(options, createHydrationFns) {
hostInsert(fragmentStartAnchor, container, anchor);
hostInsert(fragmentEndAnchor, container, anchor);
mountChildren(
n2.children,
// #10007
// such fragment like `<></>` will be compiled into
// a fragment which doesn't have a children.
// In this case fallback to an empty array
n2.children || [],
container,
fragmentEndAnchor,
parentComponent,
@@ -5204,6 +5173,7 @@ function baseCreateRenderer(options, createHydrationFns) {
}
return hostNextSibling(vnode.anchor || vnode.el);
};
let isFlushing = false;
const render = (vnode, container, namespace) => {
if (vnode == null) {
if (container._vnode) {
@@ -5220,8 +5190,12 @@ function baseCreateRenderer(options, createHydrationFns) {
namespace
);
}
flushPreFlushCbs();
flushPostFlushCbs();
if (!isFlushing) {
isFlushing = true;
flushPreFlushCbs();
flushPostFlushCbs();
isFlushing = false;
}
container._vnode = vnode;
};
const internals = {
@@ -6031,8 +6005,13 @@ let setInSSRSetupState;
);
}
const setCurrentInstance = (instance) => {
const prev = currentInstance;
internalSetCurrentInstance(instance);
instance.scope.on();
return () => {
instance.scope.off();
internalSetCurrentInstance(prev);
};
};
const unsetCurrentInstance = () => {
currentInstance && currentInstance.scope.off();
@@ -6059,7 +6038,7 @@ function setupStatefulComponent(instance, isSSR) {
const { setup } = Component;
if (setup) {
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
setCurrentInstance(instance);
const reset = setCurrentInstance(instance);
reactivity.pauseTracking();
const setupResult = callWithErrorHandling(
setup,
@@ -6071,7 +6050,7 @@ function setupStatefulComponent(instance, isSSR) {
]
);
reactivity.resetTracking();
unsetCurrentInstance();
reset();
if (shared.isPromise(setupResult)) {
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
if (isSSR) {
@@ -6140,13 +6119,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
}
}
{
setCurrentInstance(instance);
const reset = setCurrentInstance(instance);
reactivity.pauseTracking();
try {
applyOptions(instance);
} finally {
reactivity.resetTracking();
unsetCurrentInstance();
reset();
}
}
}
@@ -6203,6 +6182,51 @@ const computed = (getterOrOptions, debugOptions) => {
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
};
function useModel(props, name, options = shared.EMPTY_OBJ) {
const i = getCurrentInstance();
const camelizedName = shared.camelize(name);
const hyphenatedName = shared.hyphenate(name);
const res = reactivity.customRef((track, trigger) => {
let localValue;
watchSyncEffect(() => {
const propValue = props[name];
if (shared.hasChanged(localValue, propValue)) {
localValue = propValue;
trigger();
}
});
return {
get() {
track();
return options.get ? options.get(localValue) : localValue;
},
set(value) {
const rawProps = i.vnode.props;
if (!(rawProps && // check if parent has passed v-model
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
localValue = value;
trigger();
}
i.emit(`update:${name}`, options.set ? options.set(value) : value);
}
};
});
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
res[Symbol.iterator] = () => {
let i2 = 0;
return {
next() {
if (i2 < 2) {
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
} else {
return { done: true };
}
}
};
};
return res;
}
function h(type, propsOrChildren, children) {
const l = arguments.length;
if (l === 2) {
@@ -6255,7 +6279,7 @@ function isMemoSame(cached, memo) {
return true;
}
const version = "3.4.5";
const version = "3.4.15";
const warn$1 = shared.NOOP;
const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = void 0;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -0,0 +1,55 @@
{
"name": "@vue/reactivity",
"version": "3.4.15",
"description": "@vue/reactivity",
"main": "index.js",
"module": "dist/reactivity.esm-bundler.js",
"types": "dist/reactivity.d.ts",
"unpkg": "dist/reactivity.global.js",
"jsdelivr": "dist/reactivity.global.js",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/reactivity.d.ts",
"node": {
"production": "./dist/reactivity.cjs.prod.js",
"development": "./dist/reactivity.cjs.js",
"default": "./dist/reactivity.cjs.prod.js"
},
"module": "./dist/reactivity.esm-bundler.js",
"import": "./dist/reactivity.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/reactivity"
},
"buildOptions": {
"name": "VueReactivity",
"formats": [
"esm-bundler",
"esm-browser",
"cjs",
"global"
]
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.4.15"
}
}

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-core",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
@@ -17,6 +17,7 @@
"development": "./dist/runtime-core.cjs.js",
"default": "./dist/runtime-core.cjs.prod.js"
},
"module": "./dist/runtime-core.esm-bundler.js",
"import": "./dist/runtime-core.esm-bundler.js",
"require": "./index.js"
},
@@ -45,7 +46,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.4.5",
"@vue/reactivity": "3.4.5"
"@vue/shared": "3.4.15",
"@vue/reactivity": "3.4.15"
}
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/runtime-dom v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -407,6 +412,7 @@ function useCssVars(getter) {
function patchStyle(el, prev, next) {
const style = el.style;
const currentDisplay = style.display;
const isCssString = shared.isString(next);
if (next && !isCssString) {
if (prev && !shared.isString(prev)) {
@@ -420,7 +426,6 @@ function patchStyle(el, prev, next) {
setStyle(style, key, next[key]);
}
} else {
const currentDisplay = style.display;
if (isCssString) {
if (prev !== next) {
const cssVarText = style[CSS_VAR_TEXT];
@@ -432,9 +437,9 @@ function patchStyle(el, prev, next) {
} else if (prev) {
el.removeAttribute("style");
}
if (vShowOldKey in el) {
style.display = currentDisplay;
}
}
if (vShowOldKey in el) {
style.display = currentDisplay;
}
}
const importantRE = /\s*!important$/;
@@ -1163,32 +1168,49 @@ const vModelSelect = {
el[assignKey](
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
);
el._assigning = true;
runtimeCore.nextTick(() => {
el._assigning = false;
});
});
el[assignKey] = getModelAssigner(vnode);
},
// set value in mounted & updated because <select> relies on its children
// <option>s.
mounted(el, { value }) {
setSelected(el, value);
mounted(el, { value, oldValue, modifiers: { number } }) {
setSelected(el, value, oldValue, number);
},
beforeUpdate(el, _binding, vnode) {
el[assignKey] = getModelAssigner(vnode);
},
updated(el, { value }) {
setSelected(el, value);
updated(el, { value, oldValue, modifiers: { number } }) {
if (!el._assigning) {
setSelected(el, value, oldValue, number);
}
}
};
function setSelected(el, value) {
function setSelected(el, value, oldValue, number) {
const isMultiple = el.multiple;
if (isMultiple && !shared.isArray(value) && !shared.isSet(value)) {
const isArrayValue = shared.isArray(value);
if (isMultiple && !isArrayValue && !shared.isSet(value)) {
return;
}
if (isArrayValue && shared.looseEqual(value, oldValue)) {
return;
}
for (let i = 0, l = el.options.length; i < l; i++) {
const option = el.options[i];
const optionValue = getValue(option);
if (isMultiple) {
if (shared.isArray(value)) {
option.selected = shared.looseIndexOf(value, optionValue) > -1;
if (isArrayValue) {
const optionType = typeof optionValue;
if (optionType === "string" || optionType === "number") {
option.selected = value.includes(
number ? shared.looseToNumber(optionValue) : optionValue
);
} else {
option.selected = shared.looseIndexOf(value, optionValue) > -1;
}
} else {
option.selected = value.has(optionValue);
}

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-dom",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/runtime-dom",
"main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js",
@@ -18,6 +18,7 @@
"development": "./dist/runtime-dom.cjs.js",
"default": "./dist/runtime-dom.cjs.prod.js"
},
"module": "./dist/runtime-dom.esm-bundler.js",
"import": "./dist/runtime-dom.esm-bundler.js",
"require": "./index.js"
},
@@ -49,7 +50,7 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"csstype": "^3.1.3",
"@vue/shared": "3.4.5",
"@vue/runtime-core": "3.4.5"
"@vue/shared": "3.4.15",
"@vue/runtime-core": "3.4.15"
}
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/server-renderer v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -40,7 +45,7 @@ function ssrRenderAttrs(props, tag) {
return ret;
}
function ssrRenderDynamicAttr(key, value, tag) {
if (!isRenderableValue(value)) {
if (!shared.isRenderableAttrValue(value)) {
return ``;
}
const attrKey = tag && (tag.indexOf("-") > 0 || shared.isSVGTag(tag)) ? key : shared.propsToAttrMap[key] || key.toLowerCase();
@@ -56,18 +61,11 @@ function ssrRenderDynamicAttr(key, value, tag) {
}
}
function ssrRenderAttr(key, value) {
if (!isRenderableValue(value)) {
if (!shared.isRenderableAttrValue(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));
}
@@ -371,8 +369,7 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
() => Promise.all(
prefetches.map((prefetch) => prefetch.call(instance.proxy))
)
).catch(() => {
});
).catch(shared.NOOP);
}
return p.then(() => renderComponentSubTree(instance, slotScopeId));
} else {

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/server-renderer",
"version": "3.4.5",
"version": "3.4.15",
"description": "@vue/server-renderer",
"main": "index.js",
"module": "dist/server-renderer.esm-bundler.js",
@@ -17,6 +17,7 @@
"development": "./dist/server-renderer.cjs.js",
"default": "./dist/server-renderer.cjs.prod.js"
},
"module": "./dist/server-renderer.esm-bundler.js",
"import": "./dist/server-renderer.esm-bundler.js",
"require": "./index.js"
},
@@ -45,10 +46,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.4.5"
"vue": "3.4.15"
},
"dependencies": {
"@vue/shared": "3.4.5",
"@vue/compiler-ssr": "3.4.5"
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15"
}
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -350,6 +355,13 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
const escapeRE = /["'&<>]/;
function escapeHtml(string) {
@@ -520,6 +532,7 @@ exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
exports.isReservedProp = isReservedProp;
exports.isSSRSafeAttrName = isSSRSafeAttrName;
exports.isSVGTag = isSVGTag;

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/shared",
"version": "3.4.5",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
@@ -17,6 +17,7 @@
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},

View File

@@ -53,12 +53,12 @@ const supportedProtocols = platform.protocols.map(protocol => {
*
* @returns {Object<string, any>}
*/
function dispatchBeforeRedirect(options) {
function dispatchBeforeRedirect(options, responseDetails) {
if (options.beforeRedirects.proxy) {
options.beforeRedirects.proxy(options);
}
if (options.beforeRedirects.config) {
options.beforeRedirects.config(options);
options.beforeRedirects.config(options, responseDetails);
}
}
@@ -171,6 +171,10 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
// hotfix to support opt.all option which is required for node 20.x
lookup = (hostname, opt, cb) => {
_lookup(hostname, opt, (err, arg0, arg1) => {
if (err) {
return cb(err);
}
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);

View File

@@ -35,7 +35,31 @@ class Axios {
*
* @returns {Promise} The Promise to be fulfilled
*/
request(configOrUrl, config) {
async request(configOrUrl, config) {
try {
return await this._request(configOrUrl, config);
} catch (err) {
if (err instanceof Error) {
let dummy;
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
// slice off the Error: ... line
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
if (!err.stack) {
err.stack = stack;
// match without the 2 top stack lines
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
err.stack += '\n' + stack
}
}
throw err;
}
}
_request(configOrUrl, config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof configOrUrl === 'string') {

View File

@@ -51,9 +51,6 @@ const defaults = {
const isFormData = utils.isFormData(data);
if (isFormData) {
if (!hasJSONContentType) {
return data;
}
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}

View File

@@ -1 +1 @@
export const VERSION = "1.6.4";
export const VERSION = "1.6.7";

View File

@@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.6.4",
"version": "1.6.7",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {

View File

@@ -27,6 +27,7 @@ var preservedUrlFields = [
"protocol",
"query",
"search",
"hash",
];
// Create handlers that pass events from native requests

View File

@@ -1,6 +1,6 @@
{
"name": "follow-redirects",
"version": "1.15.4",
"version": "1.15.5",
"description": "HTTP and HTTPS modules that follow redirects.",
"license": "MIT",
"main": "index.js",

View File

@@ -1,8 +0,0 @@
'use strict';
module.exports = (flag, argv) => {
argv = argv || process.argv;
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const pos = argv.indexOf(prefix + flag);
const terminatorPos = argv.indexOf('--');
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};

View File

@@ -1,44 +0,0 @@
{
"name": "has-flag",
"version": "3.0.0",
"description": "Check if argv has a specific flag",
"license": "MIT",
"repository": "sindresorhus/has-flag",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"has",
"check",
"detect",
"contains",
"find",
"flag",
"cli",
"command-line",
"argv",
"process",
"arg",
"args",
"argument",
"arguments",
"getopt",
"minimist",
"optimist"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@@ -8,6 +8,9 @@ var gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');
var $floor = GetIntrinsic('%Math.floor%');
/** @typedef {(...args: unknown[]) => unknown} Func */
/** @type {<T extends Func = Func>(fn: T, length: number, loose?: boolean) => T} */
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== 'function') {
throw new $TypeError('`fn` is not a function');
@@ -32,9 +35,9 @@ module.exports = function setFunctionLength(fn, length) {
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(fn, 'length', length, true, true);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
} else {
define(fn, 'length', length);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
}
}
return fn;

View File

@@ -1,6 +1,6 @@
{
"name": "set-function-length",
"version": "1.1.1",
"version": "1.2.0",
"description": "Set a function's length property",
"main": "index.js",
"exports": {
@@ -8,15 +8,21 @@
"./env": "./env.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"directories": {
"test": "test"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepack": "npmignore --auto --commentLines=autogenerated && npm run emit",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"tsc": "tsc -p .",
"preemit": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map",
"emit": "npm run tsc -- --noEmit false --emitDeclarationOnly",
"postemit": "rm test/*.ts test/*.ts.map",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "npm run tsc",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
@@ -42,27 +48,38 @@
"url": "https://github.com/ljharb/set-function-length/issues"
},
"homepage": "https://github.com/ljharb/set-function-length#readme",
"dependencies": {
"define-data-property": "^1.1.1",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.2",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.1"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"@types/call-bind": "^1.0.5",
"@types/define-properties": "^1.1.5",
"@types/es-value-fixtures": "^1.4.4",
"@types/for-each": "^0.3.3",
"@types/function-bind": "^1.1.10",
"@types/gopd": "^1.0.3",
"@types/has-property-descriptors": "^1.0.3",
"@types/object-inspect": "^1.8.4",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"call-bind": "^1.0.4",
"call-bind": "^1.0.5",
"es-value-fixtures": "^1.4.2",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.1",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.1"
},
"dependencies": {
"define-data-property": "^1.1.1",
"get-intrinsic": "^1.2.1",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.0"
"tape": "^5.7.3",
"typescript": "^5.4.0-dev.20240113"
},
"engines": {
"node": ">= 0.4"
@@ -78,7 +95,9 @@
"publishConfig": {
"ignore": [
".github/workflows",
"test"
"test",
"!*.d.ts",
"!*.d.ts.map"
]
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "sortablejs",
"exportName": "Sortable",
"version": "1.15.1",
"version": "1.15.2",
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-transform-object-assign": "^7.2.0",

View File

@@ -1,22 +1,47 @@
'use strict';
const os = require('os');
const hasFlag = require('has-flag');
import process from 'node:process';
import os from 'node:os';
import tty from 'node:tty';
const env = process.env;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
forceColor = false;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = true;
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
}
if ('FORCE_COLOR' in env) {
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
const {env} = process;
let flagForceColor;
if (
hasFlag('no-color')
|| hasFlag('no-colors')
|| hasFlag('color=false')
|| hasFlag('color=never')
) {
flagForceColor = 0;
} else if (
hasFlag('color')
|| hasFlag('colors')
|| hasFlag('color=true')
|| hasFlag('color=always')
) {
flagForceColor = 1;
}
function envForceColor() {
if ('FORCE_COLOR' in env) {
if (env.FORCE_COLOR === 'true') {
return 1;
}
if (env.FORCE_COLOR === 'false') {
return 0;
}
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
@@ -28,52 +53,70 @@ function translateLevel(level) {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
has16m: level >= 3,
};
}
function supportsColor(stream) {
if (forceColor === false) {
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
const noFlagForceColor = envForceColor();
if (noFlagForceColor !== undefined) {
flagForceColor = noFlagForceColor;
}
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
if (forceColor === 0) {
return 0;
}
if (hasFlag('color=16m') ||
hasFlag('color=full') ||
hasFlag('color=truecolor')) {
return 3;
if (sniffFlags) {
if (hasFlag('color=16m')
|| hasFlag('color=full')
|| hasFlag('color=truecolor')) {
return 3;
}
if (hasFlag('color=256')) {
return 2;
}
}
if (hasFlag('color=256')) {
return 2;
// Check for Azure DevOps pipelines.
// Has to be above the `!streamIsTTY` check.
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
return 1;
}
if (stream && !stream.isTTY && forceColor !== true) {
if (haveStream && !streamIsTTY && forceColor === undefined) {
return 0;
}
const min = forceColor ? 1 : 0;
const min = forceColor || 0;
if (env.TERM === 'dumb') {
return min;
}
if (process.platform === 'win32') {
// Node.js 7.5.0 is the first version of Node.js to include a patch to
// libuv that enables 256 color output on Windows. Anything earlier and it
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
// release that supports 256 colors. Windows 10 build 14931 is the first release
// that supports 16m/TrueColor.
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
const osRelease = os.release().split('.');
if (
Number(process.versions.node.split('.')[0]) >= 8 &&
Number(osRelease[0]) >= 10 &&
Number(osRelease[2]) >= 10586
Number(osRelease[0]) >= 10
&& Number(osRelease[2]) >= 10_586
) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
return Number(osRelease[2]) >= 14_931 ? 3 : 2;
}
return 1;
}
if ('CI' in env) {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
return 3;
}
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;
}
@@ -88,14 +131,21 @@ function supportsColor(stream) {
return 3;
}
if (env.TERM === 'xterm-kitty') {
return 3;
}
if ('TERM_PROGRAM' in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
switch (env.TERM_PROGRAM) {
case 'iTerm.app':
case 'iTerm.app': {
return version >= 3 ? 3 : 2;
case 'Apple_Terminal':
}
case 'Apple_Terminal': {
return 2;
}
// No default
}
}
@@ -112,20 +162,21 @@ function supportsColor(stream) {
return 1;
}
if (env.TERM === 'dumb') {
return min;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream);
export function createSupportsColor(stream, options = {}) {
const level = _supportsColor(stream, {
streamIsTTY: stream && stream.isTTY,
...options,
});
return translateLevel(level);
}
module.exports = {
supportsColor: getSupportLevel,
stdout: getSupportLevel(process.stdout),
stderr: getSupportLevel(process.stderr)
const supportsColor = {
stdout: createSupportsColor({isTTY: tty.isatty(1)}),
stderr: createSupportsColor({isTTY: tty.isatty(2)}),
};
export default supportsColor;

View File

@@ -1,23 +1,32 @@
{
"name": "supports-color",
"version": "5.5.0",
"version": "9.4.0",
"description": "Detect whether a terminal supports color",
"license": "MIT",
"repository": "chalk/supports-color",
"funding": "https://github.com/chalk/supports-color?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"node": "./index.js",
"default": "./browser.js"
},
"engines": {
"node": ">=4"
"node": ">=12"
},
"scripts": {
"test": "xo && ava"
"//test": "xo && ava && tsd",
"test": "tsd"
},
"files": [
"index.js",
"browser.js"
"index.d.ts",
"browser.js",
"browser.d.ts"
],
"keywords": [
"color",
@@ -41,13 +50,11 @@
"truecolor",
"16m"
],
"dependencies": {
"has-flag": "^3.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"import-fresh": "^2.0.0",
"xo": "^0.20.0"
},
"browser": "browser.js"
"@types/node": "^20.3.2",
"ava": "^5.3.1",
"import-fresh": "^3.3.0",
"tsd": "^0.18.0",
"xo": "^0.54.2"
}
}

View File

@@ -541,6 +541,7 @@ function useScript(input, _options) {
resolve(options.use());
function watchForScriptLoaded({ script: script2 }) {
if (script2.id === id && script2.status === "loaded") {
script2.loaded = true;
resolve(options.use?.());
head.hooks.removeHook("script:updated", watchForScriptLoaded);
}
@@ -626,7 +627,7 @@ function useScript(input, _options) {
} else {
return script.waitForLoad().then(
(api) => {
api[fn](...args);
return api[fn](...args);
}
);
}

View 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 };

View 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 };

View File

@@ -0,0 +1,47 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/schema"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"keywords": [
"head",
"meta tags",
"types"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.10"
},
"devDependencies": {
"packrup": "^0.1.0"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -0,0 +1,40 @@
{
"name": "@unhead/dom",
"type": "module",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/dom"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.10",
"@unhead/shared": "1.8.10"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View 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 };

View File

@@ -0,0 +1,47 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/schema"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"keywords": [
"head",
"meta tags",
"types"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.10"
},
"devDependencies": {
"packrup": "^0.1.0"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -1,8 +1,12 @@
{
"name": "unhead",
"type": "module",
"version": "1.8.9",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"version": "1.8.10",
"author": {
"name": "Harlan Wilton",
"email": "harlan@harlanzw.com",
"url": "https://harlanzw.com/"
},
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
@@ -30,9 +34,9 @@
],
"dependencies": {
"hookable": "^5.5.3",
"@unhead/dom": "1.8.9",
"@unhead/shared": "1.8.9",
"@unhead/schema": "1.8.9"
"@unhead/dom": "1.8.10",
"@unhead/schema": "1.8.10",
"@unhead/shared": "1.8.10"
},
"scripts": {
"build": "unbuild .",

View File

@@ -1,3 +1,8 @@
/**
* vue v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -1,3 +1,8 @@
/**
* vue v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

1
.output/server/node_modules/vue/index.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './index.js'

View File

@@ -0,0 +1,561 @@
/**
* @vue/shared v3.4.15
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
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 PatchFlags = {
"TEXT": 1,
"1": "TEXT",
"CLASS": 2,
"2": "CLASS",
"STYLE": 4,
"4": "STYLE",
"PROPS": 8,
"8": "PROPS",
"FULL_PROPS": 16,
"16": "FULL_PROPS",
"NEED_HYDRATION": 32,
"32": "NEED_HYDRATION",
"STABLE_FRAGMENT": 64,
"64": "STABLE_FRAGMENT",
"KEYED_FRAGMENT": 128,
"128": "KEYED_FRAGMENT",
"UNKEYED_FRAGMENT": 256,
"256": "UNKEYED_FRAGMENT",
"NEED_PATCH": 512,
"512": "NEED_PATCH",
"DYNAMIC_SLOTS": 1024,
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"BAIL": -2,
"-2": "BAIL"
};
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 ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
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,Error";
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 MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
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 isMathMLTag = /* @__PURE__ */ makeMap(MATH_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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
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.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isRenderableAttrValue = isRenderableAttrValue;
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;

View File

@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
"types": "dist/shared.d.ts",
"files": [
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/shared.d.ts",
"node": {
"production": "./dist/shared.cjs.prod.js",
"development": "./dist/shared.cjs.js",
"default": "./dist/shared.cjs.prod.js"
},
"module": "./dist/shared.esm-bundler.js",
"import": "./dist/shared.esm-bundler.js",
"require": "./index.js"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/shared"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
}

View File

@@ -1,6 +1,6 @@
{
"name": "vue",
"version": "3.4.5",
"version": "3.4.15",
"description": "The progressive JavaScript framework for building modern web UI.",
"main": "index.js",
"module": "dist/vue.runtime.esm-bundler.js",
@@ -20,15 +20,16 @@
".": {
"import": {
"types": "./dist/vue.d.mts",
"node": "./index.mjs",
"default": "./dist/vue.runtime.esm-bundler.js"
},
"require": {
"types": "./dist/vue.d.ts",
"node": {
"production": "./dist/vue.cjs.prod.js",
"development": "./dist/vue.cjs.js",
"default": "./dist/vue.cjs.prod.js"
},
"default": "./dist/vue.runtime.esm-bundler.js"
},
"require": {
"types": "./dist/vue.d.ts",
"default": "./index.js"
}
},
@@ -94,11 +95,11 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue#readme",
"dependencies": {
"@vue/shared": "3.4.5",
"@vue/runtime-dom": "3.4.5",
"@vue/server-renderer": "3.4.5",
"@vue/compiler-dom": "3.4.5",
"@vue/compiler-sfc": "3.4.5"
"@vue/compiler-dom": "3.4.15",
"@vue/server-renderer": "3.4.15",
"@vue/runtime-dom": "3.4.15",
"@vue/compiler-sfc": "3.4.15",
"@vue/shared": "3.4.15"
},
"peerDependencies": {
"typescript": "*"