讨论加特殊图标

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-03-21 15:55:33 +08:00
parent 7cc2b264d2
commit 27f3bcacbf
272 changed files with 18932 additions and 35894 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/parser",
"version": "7.25.0",
"version": "7.26.10",
"description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser",
@@ -33,15 +33,21 @@
"engines": {
"node": ">=6.0.0"
},
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
"dependencies": {
"@babel/types": "^7.26.10"
},
"devDependencies": {
"@babel/code-frame": "^7.24.7",
"@babel/helper-check-duplicate-nodes": "^7.24.7",
"@babel/helper-fixtures": "^7.24.8",
"@babel/helper-string-parser": "^7.24.8",
"@babel/helper-validator-identifier": "^7.24.7",
"@babel/types": "^7.25.0",
"@babel/code-frame": "^7.26.2",
"@babel/helper-check-duplicate-nodes": "^7.25.9",
"@babel/helper-fixtures": "^7.26.0",
"@babel/helper-string-parser": "^7.25.9",
"@babel/helper-validator-identifier": "^7.25.9",
"charcodes": "^0.2.0"
},
"bin": "./bin/babel-parser.js",
"type": "commonjs"
"type": "commonjs",
"__npminstall_done": true,
"_from": "@babel/parser@7.26.10",
"_resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.26.10.tgz"
}

View File

@@ -1,133 +0,0 @@
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

@@ -1,40 +0,0 @@
{
"name": "@unhead/dom",
"type": "module",
"version": "1.8.8",
"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/shared": "1.8.8",
"@unhead/schema": "1.8.8"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -1,640 +0,0 @@
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

@@ -1,47 +0,0 @@
{
"name": "@unhead/shared",
"type": "module",
"version": "1.8.8",
"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.8"
},
"devDependencies": {
"packrup": "^0.1.0"
},
"scripts": {
"build": "unbuild .",
"stub": "unbuild . --stub",
"export:sizes": "npx export-size . -r"
}
}

View File

@@ -1,84 +0,0 @@
import { TagsWithInnerContent, SelfClosingTags } from '@unhead/shared';
function encodeAttribute(value) {
return String(value).replace(/"/g, "&quot;");
}
function propsToString(props) {
const attrs = [];
for (const [key, value] of Object.entries(props)) {
if (value !== false && value !== null)
attrs.push(value === true ? key : `${key}="${encodeAttribute(value)}"`);
}
return `${attrs.length > 0 ? " " : ""}${attrs.join(" ")}`;
}
function escapeHtml(str) {
return str.replace(/[&<>"'/]/g, (char) => {
switch (char) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case '"':
return "&quot;";
case "'":
return "&#x27;";
case "/":
return "&#x2F;";
default:
return char;
}
});
}
function tagToString(tag) {
const attrs = propsToString(tag.props);
const openTag = `<${tag.tag}${attrs}>`;
if (!TagsWithInnerContent.includes(tag.tag))
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
let content = String(tag.innerHTML || "");
if (tag.textContent)
content = escapeHtml(String(tag.textContent));
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
}
function ssrRenderTags(tags) {
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
for (const tag of tags) {
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
schema[tag.tag] = { ...schema[tag.tag], ...tag.props };
continue;
}
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
}
return {
headTags: schema.tags.head.join("\n"),
bodyTags: schema.tags.bodyClose.join("\n"),
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
htmlAttrs: propsToString(schema.htmlAttrs),
bodyAttrs: propsToString(schema.bodyAttrs)
};
}
async function renderSSRHead(head) {
const beforeRenderCtx = { shouldRender: true };
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
if (!beforeRenderCtx.shouldRender) {
return {
headTags: "",
bodyTags: "",
bodyTagsOpen: "",
htmlAttrs: "",
bodyAttrs: ""
};
}
const ctx = { tags: await head.resolveTags() };
await head.hooks.callHook("ssr:render", ctx);
const html = ssrRenderTags(ctx.tags);
const renderCtx = { tags: ctx.tags, html };
await head.hooks.callHook("ssr:rendered", renderCtx);
return renderCtx.html;
}
export { escapeHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString };

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/compiler-core.cjs.prod.js')
} else {
module.exports = require('./dist/compiler-core.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-core",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -9,6 +9,20 @@
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/compiler-core.d.ts",
"node": {
"production": "./dist/compiler-core.cjs.prod.js",
"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"
},
"./*": "./*"
},
"buildOptions": {
"name": "VueCompilerCore",
"compat": true,
@@ -32,12 +46,16 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.23.3",
"@babel/parser": "^7.25.3",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2",
"@vue/shared": "3.3.9"
"source-map-js": "^1.2.0",
"@vue/shared": "3.5.13"
},
"devDependencies": {
"@babel/types": "^7.23.3"
}
"@babel/types": "^7.25.2"
},
"__npminstall_done": true,
"_from": "@vue/compiler-core@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.13.tgz"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/compiler-dom.cjs.prod.js')
} else {
module.exports = require('./dist/compiler-dom.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-dom",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
@@ -11,6 +11,20 @@
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/compiler-dom.d.ts",
"node": {
"production": "./dist/compiler-dom.cjs.prod.js",
"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"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"name": "VueCompilerDOM",
@@ -37,7 +51,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.3.9",
"@vue/compiler-core": "3.3.9"
}
"@vue/shared": "3.5.13",
"@vue/compiler-core": "3.5.13"
},
"__npminstall_done": true,
"_from": "@vue/compiler-dom@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz"
}

View File

@@ -1,3 +1,8 @@
/**
* @vue/compiler-ssr v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -16,11 +21,17 @@ const SSR_RENDER_ATTRS = Symbol(`ssrRenderAttrs`);
const SSR_RENDER_ATTR = Symbol(`ssrRenderAttr`);
const SSR_RENDER_DYNAMIC_ATTR = Symbol(`ssrRenderDynamicAttr`);
const SSR_RENDER_LIST = Symbol(`ssrRenderList`);
const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(`ssrIncludeBooleanAttr`);
const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(
`ssrIncludeBooleanAttr`
);
const SSR_LOOSE_EQUAL = Symbol(`ssrLooseEqual`);
const SSR_LOOSE_CONTAIN = Symbol(`ssrLooseContain`);
const SSR_RENDER_DYNAMIC_MODEL = Symbol(`ssrRenderDynamicModel`);
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(`ssrGetDynamicModelProps`);
const SSR_RENDER_DYNAMIC_MODEL = Symbol(
`ssrRenderDynamicModel`
);
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(
`ssrGetDynamicModelProps`
);
const SSR_RENDER_TELEPORT = Symbol(`ssrRenderTeleport`);
const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`);
const SSR_GET_DIRECTIVE_PROPS = Symbol(`ssrGetDirectiveProps`);
@@ -51,7 +62,7 @@ const ssrTransformIf = compilerDom.createStructuralDirectiveTransform(
/^(if|else|else-if)$/,
compilerDom.processIf
);
function ssrProcessIf(node, context, disableNestedFragments = false) {
function ssrProcessIf(node, context, disableNestedFragments = false, disableComment = false) {
const [rootBranch] = node.branches;
const ifStatement = compilerDom.createIfStatement(
rootBranch.condition,
@@ -75,7 +86,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
currentIf.alternate = branchBlockStatement;
}
}
if (!currentIf.alternate) {
if (!currentIf.alternate && !disableComment) {
currentIf.alternate = compilerDom.createBlockStatement([
compilerDom.createCallExpression(`_push`, ["`<!---->`"])
]);
@@ -88,10 +99,7 @@ function processIfBranch(branch, context, disableNestedFragments = false) {
return processChildrenAsStatement(branch, context, needFragmentWrapper);
}
const ssrTransformFor = compilerDom.createStructuralDirectiveTransform(
"for",
compilerDom.processFor
);
const ssrTransformFor = compilerDom.createStructuralDirectiveTransform("for", compilerDom.processFor);
function ssrProcessFor(node, context, disableNestedFragments = false) {
const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
const renderLoop = compilerDom.createFunctionExpression(
@@ -132,13 +140,20 @@ const ssrTransformSlotOutlet = (node, context) => {
args.push(`"${context.scopeId}-s"`);
}
let method = SSR_RENDER_SLOT;
const parent = context.parent;
if (parent && parent.type === 1 && parent.tagType === 1 && compilerDom.resolveComponentType(parent, context, true) === compilerDom.TRANSITION && parent.children.filter((c) => c.type === 1).length === 1) {
method = SSR_RENDER_SLOT_INNER;
if (!(context.scopeId && context.slotted !== false)) {
args.push("null");
let parent = context.parent;
if (parent) {
const children = parent.children;
if (parent.type === 10) {
parent = context.grandParent;
}
let componentType;
if (parent.type === 1 && parent.tagType === 1 && ((componentType = compilerDom.resolveComponentType(parent, context, true)) === compilerDom.TRANSITION || componentType === compilerDom.TRANSITION_GROUP) && children.filter((c) => c.type === 1).length === 1) {
method = SSR_RENDER_SLOT_INNER;
if (!(context.scopeId && context.slotted !== false)) {
args.push("null");
}
args.push("true");
}
args.push("true");
}
node.ssrCodegenNode = compilerDom.createCallExpression(context.helper(method), args);
}
@@ -292,7 +307,6 @@ const ssrTransformElement = (node, context) => {
false,
false,
true
/* ssr */
);
if (props || directives.length) {
const mergedProps = buildSSRProps(props, directives, context);
@@ -348,6 +362,28 @@ const ssrTransformElement = (node, context) => {
])
];
}
} else if (directives.length && !node.children.length) {
const vText = compilerDom.findDir(node, "text");
if (!vText) {
const tempId = `_temp${context.temps++}`;
propsExp.arguments = [
compilerDom.createAssignmentExpression(
compilerDom.createSimpleExpression(tempId, false),
mergedProps
)
];
rawChildrenMap.set(
node,
compilerDom.createConditionalExpression(
compilerDom.createSimpleExpression(`"textContent" in ${tempId}`, false),
compilerDom.createCallExpression(context.helper(SSR_INTERPOLATE), [
compilerDom.createSimpleExpression(`${tempId}.textContent`, false)
]),
compilerDom.createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
false
)
);
}
}
if (needTagForRuntime) {
propsExp.arguments.push(`"${node.tag}"`);
@@ -365,7 +401,10 @@ const ssrTransformElement = (node, context) => {
}
if (prop.type === 7) {
if (prop.name === "html" && prop.exp) {
rawChildrenMap.set(node, prop.exp);
rawChildrenMap.set(
node,
compilerDom.createCompoundExpression([`(`, prop.exp, `) ?? ''`])
);
} else if (prop.name === "text" && prop.exp) {
node.children = [compilerDom.createInterpolation(prop.exp, prop.loc)];
} else if (prop.name === "slot") {
@@ -428,7 +467,6 @@ const ssrTransformElement = (node, context) => {
compilerDom.createSimpleExpression(" " + attrName, true),
compilerDom.createSimpleExpression("", true),
false
/* no newline */
)
);
} else if (shared.isSSRSafeAttrName(attrName)) {
@@ -463,13 +501,14 @@ const ssrTransformElement = (node, context) => {
}
}
} else {
if (node.tag === "textarea" && prop.name === "value" && prop.value) {
const name = prop.name;
if (node.tag === "textarea" && name === "value" && prop.value) {
rawChildrenMap.set(node, shared.escapeHtml(prop.value.content));
} else if (!needMergeProps) {
if (prop.name === "key" || prop.name === "ref") {
if (name === "key" || name === "ref") {
continue;
}
if (prop.name === "class" && prop.value) {
if (name === "class" && prop.value) {
staticClassBinding = JSON.stringify(prop.value.content);
}
openTag.push(
@@ -573,7 +612,6 @@ function ssrTransformTransitionGroup(node, context) {
true,
false,
true
/* ssr (skip event listeners) */
);
let propsExp = null;
if (props || directives.length) {
@@ -613,6 +651,13 @@ function ssrProcessTransitionGroup(node, context) {
* be patched using the same key map) so we need to account for that here
* by disabling nested fragment wrappers from being generated.
*/
true,
/**
* TransitionGroup filters out comment children at runtime and thus
* doesn't expect comments to be present during hydration. We need to
* account for that by disabling the empty comment that is otherwise
* rendered for a falsy v-if that has no v-else specified. (#6715)
*/
true
);
context.pushStringPart(`</`);
@@ -627,11 +672,11 @@ function ssrProcessTransitionGroup(node, context) {
context.pushStringPart(` ${scopeId}`);
}
context.pushStringPart(`>`);
processChildren(node, context, false, true);
processChildren(node, context, false, true, true);
context.pushStringPart(`</${tag.value.content}>`);
}
} else {
processChildren(node, context, true, true);
processChildren(node, context, true, true, true);
}
}
@@ -777,7 +822,6 @@ function ssrProcessComponent(node, context, parent) {
context,
false,
true
/* withSlotScopeId */
),
vnodeBranch
);
@@ -801,7 +845,7 @@ const vnodeDirectiveTransforms = {
...baseDirectiveTransforms,
...compilerDom.DOMDirectiveTransforms
};
function createVNodeSlotBranch(props, vForExp, children, parentContext) {
function createVNodeSlotBranch(slotProps, vFor, children, parentContext) {
const rawOptions = rawOptionsMap.get(parentContext.root);
const subOptions = {
...rawOptions,
@@ -815,32 +859,26 @@ function createVNodeSlotBranch(props, vForExp, children, parentContext) {
...rawOptions.directiveTransforms || {}
}
};
const wrapperProps = [];
if (slotProps) {
wrapperProps.push({
type: 7,
name: "slot",
exp: slotProps,
arg: void 0,
modifiers: [],
loc: compilerDom.locStub
});
}
if (vFor) {
wrapperProps.push(shared.extend({}, vFor));
}
const wrapperNode = {
type: 1,
ns: 0,
tag: "template",
tagType: 3,
isSelfClosing: false,
// important: provide v-slot="props" and v-for="exp" on the wrapper for
// proper scope analysis
props: [
{
type: 7,
name: "slot",
exp: props,
arg: void 0,
modifiers: [],
loc: compilerDom.locStub
},
{
type: 7,
name: "for",
exp: vForExp,
arg: void 0,
modifiers: [],
loc: compilerDom.locStub
}
],
props: wrapperProps,
children,
loc: compilerDom.locStub,
codegenNode: void 0
@@ -874,7 +912,7 @@ function subTransform(node, options, parentContext) {
function clone(v) {
if (shared.isArray(v)) {
return v.map(clone);
} else if (shared.isObject(v)) {
} else if (shared.isPlainObject(v)) {
const res = {};
for (const key in v) {
res[key] = clone(v[key]);
@@ -956,7 +994,7 @@ function createChildContext(parent, withSlotScopeId = parent.withSlotScopeId) {
withSlotScopeId
);
}
function processChildren(parent, context, asFragment = false, disableNestedFragments = false) {
function processChildren(parent, context, asFragment = false, disableNestedFragments = false, disableComment = false) {
if (asFragment) {
context.pushStringPart(`<!--[-->`);
}
@@ -992,15 +1030,19 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
context.pushStringPart(shared.escapeHtml(child.content));
break;
case 3:
context.pushStringPart(`<!--${child.content}-->`);
if (!disableComment) {
context.pushStringPart(`<!--${child.content}-->`);
}
break;
case 5:
context.pushStringPart(
compilerDom.createCallExpression(context.helper(SSR_INTERPOLATE), [child.content])
compilerDom.createCallExpression(context.helper(SSR_INTERPOLATE), [
child.content
])
);
break;
case 9:
ssrProcessIf(child, context, disableNestedFragments);
ssrProcessIf(child, context, disableNestedFragments, disableComment);
break;
case 11:
ssrProcessFor(child, context, disableNestedFragments);
@@ -1066,7 +1108,6 @@ const ssrTransformModel = (dir, node, context) => {
compilerDom.createSimpleExpression(" selected", true),
compilerDom.createSimpleExpression("", true),
false
/* no newline */
)
);
}
@@ -1158,11 +1199,18 @@ const ssrTransformModel = (dir, node, context) => {
checkDuplicatedValue();
node.children = [compilerDom.createInterpolation(model, model.loc)];
} else if (node.tag === "select") {
node.children.forEach((child) => {
if (child.type === 1) {
processOption(child);
}
});
const processChildren = (children) => {
children.forEach((child) => {
if (child.type === 1) {
processOption(child);
} else if (child.type === 11) {
processChildren(child.children);
} else if (child.type === 9) {
child.branches.forEach((b) => processChildren(b.children));
}
});
};
processChildren(node.children);
} else {
context.onError(
compilerDom.createDOMCompilerError(
@@ -1201,7 +1249,6 @@ const ssrTransformShow = (dir, node, context) => {
)
]),
false
/* no newline */
)
)
]
@@ -1214,7 +1261,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
if (node.type === 0) {
context.identifiers._attrs = 1;
}
if (node.type === 1 && node.tagType === 1 && (compilerDom.isBuiltInType(node.tag, "Transition") || compilerDom.isBuiltInType(node.tag, "KeepAlive"))) {
if (node.type === 1 && node.tagType === 1 && (node.tag === "transition" || node.tag === "Transition" || node.tag === "KeepAlive" || node.tag === "keep-alive")) {
const rootChildren = filterChild(context.root);
if (rootChildren.length === 1 && rootChildren[0] === node) {
if (hasSingleChild(node)) {
@@ -1231,8 +1278,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
let hasEncounteredIf = false;
for (const c of filterChild(parent)) {
if (c.type === 9 || c.type === 1 && compilerDom.findDir(c, "if")) {
if (hasEncounteredIf)
return;
if (hasEncounteredIf) return;
hasEncounteredIf = true;
} else if (
// node before v-if
@@ -1281,7 +1327,7 @@ const ssrInjectCssVars = (node, context) => {
};
function injectCssVars(node) {
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !compilerDom.findDir(node, "for")) {
if (compilerDom.isBuiltInType(node.tag, "Suspense")) {
if (node.tag === "suspense" || node.tag === "Suspense") {
for (const child of node.children) {
if (child.type === 1 && child.tagType === 3) {
child.children.forEach(injectCssVars);
@@ -1302,10 +1348,9 @@ function injectCssVars(node) {
}
}
function compile(template, options = {}) {
function compile(source, options = {}) {
options = {
...options,
// apply DOM-specific parsing options
...compilerDom.parserOptions,
ssr: true,
inSSR: true,
@@ -1316,7 +1361,7 @@ function compile(template, options = {}) {
cacheHandlers: false,
hoistStatic: false
};
const ast = compilerDom.baseParse(template, options);
const ast = typeof source === "string" ? compilerDom.baseParse(source, options) : source;
rawOptionsMap.set(ast, options);
compilerDom.transform(ast, {
...options,

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-ssr",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.3.9",
"@vue/compiler-dom": "3.3.9"
}
"@vue/shared": "3.5.13",
"@vue/compiler-dom": "3.5.13"
},
"__npminstall_done": true,
"_from": "@vue/compiler-ssr@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/reactivity.cjs.prod.js')
} else {
module.exports = require('./dist/reactivity.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/reactivity",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/reactivity",
"main": "index.js",
"module": "dist/reactivity.esm-bundler.js",
@@ -11,6 +11,20 @@
"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",
@@ -36,6 +50,9 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.3.9"
}
"@vue/shared": "3.5.13"
},
"__npminstall_done": true,
"_from": "@vue/reactivity@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.13.tgz"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/runtime-core.cjs.prod.js')
} else {
module.exports = require('./dist/runtime-core.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-core",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
@@ -9,6 +9,20 @@
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/runtime-core.d.ts",
"node": {
"production": "./dist/runtime-core.cjs.prod.js",
"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"
},
"./*": "./*"
},
"buildOptions": {
"name": "VueRuntimeCore",
"formats": [
@@ -32,7 +46,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.3.9",
"@vue/reactivity": "3.3.9"
}
"@vue/shared": "3.5.13",
"@vue/reactivity": "3.5.13"
},
"__npminstall_done": true,
"_from": "@vue/runtime-core@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.5.13.tgz"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/runtime-dom.cjs.prod.js')
} else {
module.exports = require('./dist/runtime-dom.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-dom",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/runtime-dom",
"main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js",
@@ -10,6 +10,20 @@
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/runtime-dom.d.ts",
"node": {
"production": "./dist/runtime-dom.cjs.prod.js",
"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"
},
"./*": "./*"
},
"sideEffects": false,
"buildOptions": {
"name": "VueRuntimeDOM",
@@ -35,8 +49,15 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"csstype": "^3.1.2",
"@vue/shared": "3.3.9",
"@vue/runtime-core": "3.3.9"
}
"csstype": "^3.1.3",
"@vue/shared": "3.5.13",
"@vue/runtime-core": "3.5.13",
"@vue/reactivity": "3.5.13"
},
"devDependencies": {
"@types/trusted-types": "^2.0.7"
},
"__npminstall_done": true,
"_from": "@vue/runtime-dom@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.5.13.tgz"
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,8 @@
/**
* @vue/server-renderer v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -19,7 +24,7 @@ function _interopNamespaceDefault(e) {
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
const shouldIgnoreProp = shared.makeMap(
const shouldIgnoreProp = /* @__PURE__ */ shared.makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`
);
function ssrRenderAttrs(props, tag) {
@@ -33,6 +38,8 @@ function ssrRenderAttrs(props, tag) {
ret += ` class="${ssrRenderClass(value)}"`;
} else if (key === "style") {
ret += ` style="${ssrRenderStyle(value)}"`;
} else if (key === "className") {
ret += ` class="${String(value)}"`;
} else {
ret += ssrRenderDynamicAttr(key, value, tag);
}
@@ -40,7 +47,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 +63,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));
}
@@ -90,6 +90,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
);
}
const { ensureValidVNode } = Vue.ssrUtils;
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
push(`<!--[-->`);
ssrRenderSlotInner(
@@ -117,7 +118,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
slotScopeId ? " " + slotScopeId : ""
);
if (shared.isArray(ret)) {
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
const validSlotContent = ensureValidVNode(ret);
if (validSlotContent) {
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId
);
} else if (fallbackRenderFn) {
fallbackRenderFn();
}
} else {
let isEmptySlot = true;
if (transition) {
@@ -135,7 +146,13 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
fallbackRenderFn();
}
} else {
for (let i = 0; i < slotBuffer.length; i++) {
let start = 0;
let end = slotBuffer.length;
if (transition && slotBuffer[0] === "<!--[-->" && slotBuffer[end - 1] === "<!--]-->") {
start++;
end--;
}
for (let i = start; i < end; i++) {
push(slotBuffer[i]);
}
}
@@ -144,13 +161,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
fallbackRenderFn();
}
}
const commentTestRE = /^<!--.*-->$/s;
const commentTestRE = /^<!--[\s\S]*-->$/;
const commentRE = /<!--[^]*?-->/gm;
function isComment(item) {
if (typeof item !== "string" || !commentTestRE.test(item))
return false;
if (item.length <= 8)
return true;
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
if (item.length <= 8) return true;
return !item.replace(commentRE, "").trim();
}
@@ -163,9 +178,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
let teleportContent;
if (disabled) {
contentRenderFn(parentPush);
teleportContent = `<!--teleport anchor-->`;
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
} else {
const { getBuffer, push } = createBuffer();
push(`<!--teleport start anchor-->`);
contentRenderFn(push);
push(`<!--teleport anchor-->`);
teleportContent = getBuffer();
@@ -216,7 +232,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
return dir.getSSRProps(
{
dir,
instance,
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
value,
oldValue: void 0,
arg,
@@ -326,7 +342,9 @@ const {
setCurrentRenderingInstance,
setupComponent,
renderComponentRoot,
normalizeVNode
normalizeVNode,
pushWarningContext,
popWarningContext
} = Vue.ssrUtils;
function createBuffer() {
let appendable = false;
@@ -339,9 +357,9 @@ function createBuffer() {
const isStringItem = shared.isString(item);
if (appendable && isStringItem) {
buffer[buffer.length - 1] += item;
} else {
buffer.push(item);
return;
}
buffer.push(item);
appendable = isStringItem;
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
buffer.hasAsync = true;
@@ -350,22 +368,27 @@ function createBuffer() {
};
}
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
const instance = createComponentInstance(vnode, parentComponent, null);
const instance = vnode.component = createComponentInstance(
vnode,
parentComponent,
null
);
const res = setupComponent(
instance,
true
/* isSSR */
);
const hasAsyncSetup = shared.isPromise(res);
const prefetches = instance.sp;
let prefetches = instance.sp;
if (hasAsyncSetup || prefetches) {
let p = hasAsyncSetup ? res : Promise.resolve();
if (prefetches) {
p = p.then(
() => Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)))
).catch(() => {
});
}
const p = Promise.resolve(res).then(() => {
if (hasAsyncSetup) prefetches = instance.sp;
if (prefetches) {
return Promise.all(
prefetches.map((prefetch) => prefetch.call(instance.proxy))
);
}
}).catch(shared.NOOP);
return p.then(() => renderComponentSubTree(instance, slotScopeId));
} else {
return renderComponentSubTree(instance, slotScopeId);
@@ -388,10 +411,6 @@ function renderComponentSubTree(instance, slotScopeId) {
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
comp.ssrRender = ssrCompile(comp.template, instance);
}
for (const e of instance.scope.effects) {
if (e.computed)
e.computed._cacheable = true;
}
const ssrRender = instance.ssrRender || comp.ssrRender;
if (ssrRender) {
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
@@ -414,9 +433,11 @@ function renderComponentSubTree(instance, slotScopeId) {
}
}
if (slotScopeId) {
if (!hasCloned)
attrs = { ...attrs };
attrs[slotScopeId.trim()] = "";
if (!hasCloned) attrs = { ...attrs };
const slotScopeIdList = slotScopeId.trim().split(" ");
for (let i = 0; i < slotScopeIdList.length; i++) {
attrs[slotScopeIdList[i]] = "";
}
}
const prev = setCurrentRenderingInstance(instance);
try {
@@ -450,7 +471,10 @@ function renderComponentSubTree(instance, slotScopeId) {
return getBuffer();
}
function renderVNode(push, vnode, parentComponent, slotScopeId) {
const { type, shapeFlag, children } = vnode;
const { type, shapeFlag, children, dirs, props } = vnode;
if (dirs) {
vnode.props = applySSRDirectives(vnode, props, dirs);
}
switch (type) {
case Vue.Text:
push(shared.escapeHtml(children));
@@ -501,11 +525,8 @@ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
}
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
const tag = vnode.type;
let { props, children, shapeFlag, scopeId, dirs } = vnode;
let { props, children, shapeFlag, scopeId } = vnode;
let openTag = `<${tag}`;
if (dirs) {
props = applySSRDirectives(vnode, props, dirs);
}
if (props) {
openTag += ssrRenderAttrs(props, tag);
}
@@ -563,8 +584,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
} = binding;
if (getSSRProps) {
const props = getSSRProps(binding, vnode);
if (props)
toMerge.push(props);
if (props) toMerge.push(props);
}
}
return Vue.mergeProps(rawProps || {}, ...toMerge);
@@ -601,24 +621,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
}
const { isVNode: isVNode$1 } = Vue.ssrUtils;
async function unrollBuffer$1(buffer) {
if (buffer.hasAsync) {
let ret = "";
for (let i = 0; i < buffer.length; i++) {
let item = buffer[i];
if (shared.isPromise(item)) {
item = await item;
}
if (shared.isString(item)) {
ret += item;
} else {
ret += await unrollBuffer$1(item);
}
}
return ret;
} else {
return unrollBufferSync$1(buffer);
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
if (!buffer.hasAsync) {
return parentRet + unrollBufferSync$1(buffer);
}
let ret = parentRet;
for (let i = startIndex; i < buffer.length; i += 1) {
const item = buffer[i];
if (shared.isString(item)) {
ret += item;
continue;
}
if (shared.isPromise(item)) {
return item.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, ret, i);
});
}
const result = nestedUnrollBuffer(item, ret, 0);
if (shared.isPromise(result)) {
return result.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, "", i);
});
}
ret = result;
}
return ret;
}
function unrollBuffer$1(buffer) {
return nestedUnrollBuffer(buffer, "", 0);
}
function unrollBufferSync$1(buffer) {
let ret = "";
@@ -717,7 +749,7 @@ function renderToStream(input, context = {}) {
return renderToNodeStream(input, context);
}
function renderToNodeStream(input, context = {}) {
const stream = new (require("stream")).Readable({ read() {
const stream = new (require("node:stream")).Readable({ read() {
} }) ;
if (!stream) {
throw new Error(
@@ -752,8 +784,7 @@ function renderToWebStream(input, context = {}) {
start(controller) {
renderToSimpleStream(input, context, {
push(content) {
if (cancelled)
return;
if (cancelled) return;
if (content != null) {
controller.enqueue(encoder.encode(content));
} else {

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/server-renderer.cjs.prod.js')
} else {
module.exports = require('./dist/server-renderer.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/server-renderer",
"version": "3.3.9",
"version": "3.5.13",
"description": "@vue/server-renderer",
"main": "index.js",
"module": "dist/server-renderer.esm-bundler.js",
@@ -9,6 +9,20 @@
"index.js",
"dist"
],
"exports": {
".": {
"types": "./dist/server-renderer.d.ts",
"node": {
"production": "./dist/server-renderer.cjs.prod.js",
"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"
},
"./*": "./*"
},
"buildOptions": {
"name": "VueServerRenderer",
"formats": [
@@ -32,10 +46,13 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.3.9"
"vue": "3.5.13"
},
"dependencies": {
"@vue/compiler-ssr": "3.3.9",
"@vue/shared": "3.3.9"
}
"@vue/shared": "3.5.13",
"@vue/compiler-ssr": "3.5.13"
},
"__npminstall_done": true,
"_from": "@vue/server-renderer@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.5.13.tgz"
}

View File

@@ -1,474 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const map = /* @__PURE__ */ Object.create(null);
const list = str.split(",");
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
}
const EMPTY_OBJ = Object.freeze({}) ;
const EMPTY_ARR = Object.freeze([]) ;
const NOOP = () => {
};
const NO = () => false;
const onRE = /^on[^a-z]/;
const isOn = (key) => onRE.test(key);
const isModelListener = (key) => key.startsWith("onUpdate:");
const extend = Object.assign;
const remove = (arr, el) => {
const i = arr.indexOf(el);
if (i > -1) {
arr.splice(i, 1);
}
};
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
const isArray = Array.isArray;
const isMap = (val) => toTypeString(val) === "[object Map]";
const isSet = (val) => toTypeString(val) === "[object Set]";
const isDate = (val) => toTypeString(val) === "[object Date]";
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isSymbol = (val) => typeof val === "symbol";
const isObject = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
const toRawType = (value) => {
return toTypeString(value).slice(8, -1);
};
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
const isReservedProp = /* @__PURE__ */ makeMap(
// the leading comma is intentional so empty string "" is also included
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
);
const isBuiltInDirective = /* @__PURE__ */ makeMap(
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
);
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction(
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
);
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const toHandlerKey = cacheStringFunction((str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
});
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {
for (let i = 0; i < fns.length; i++) {
fns[i](arg);
}
};
const def = (obj, key, value) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
value
});
};
const looseToNumber = (val) => {
const n = parseFloat(val);
return isNaN(n) ? val : n;
};
const toNumber = (val) => {
const n = isString(val) ? Number(val) : NaN;
return isNaN(n) ? val : n;
};
let _globalThis;
const getGlobalThis = () => {
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
};
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
function genPropsAccessExp(name) {
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
}
const PatchFlagNames = {
[1]: `TEXT`,
[2]: `CLASS`,
[4]: `STYLE`,
[8]: `PROPS`,
[16]: `FULL_PROPS`,
[32]: `NEED_HYDRATION`,
[64]: `STABLE_FRAGMENT`,
[128]: `KEYED_FRAGMENT`,
[256]: `UNKEYED_FRAGMENT`,
[512]: `NEED_PATCH`,
[1024]: `DYNAMIC_SLOTS`,
[2048]: `DEV_ROOT_FRAGMENT`,
[-1]: `HOISTED`,
[-2]: `BAIL`
};
const slotFlagsText = {
[1]: "STABLE",
[2]: "DYNAMIC",
[3]: "FORWARDED"
};
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
const isGloballyWhitelisted = isGloballyAllowed;
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
if (count >= start) {
for (let j = i - range; j <= i + range || end > count; j++) {
if (j < 0 || j >= lines.length)
continue;
const line = j + 1;
res.push(
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
);
const lineLength = lines[j].length;
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
if (j === i) {
const pad = start - (count - (lineLength + newLineSeqLength));
const length = Math.max(
1,
end > count ? lineLength - pad : end - start
);
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
} else if (j > i) {
if (end > count) {
const length = Math.max(Math.min(end - count, lineLength), 1);
res.push(` | ` + "^".repeat(length));
}
count += lineLength + newLineSeqLength;
}
}
break;
}
}
return res.join("\n");
}
function normalizeStyle(value) {
if (isArray(value)) {
const res = {};
for (let i = 0; i < value.length; i++) {
const item = value[i];
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
if (normalized) {
for (const key in normalized) {
res[key] = normalized[key];
}
}
}
return res;
} else if (isString(value) || isObject(value)) {
return value;
}
}
const listDelimiterRE = /;(?![^(]*\))/g;
const propertyDelimiterRE = /:([^]+)/;
const styleCommentRE = /\/\*[^]*?\*\//g;
function parseStringStyle(cssText) {
const ret = {};
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
if (item) {
const tmp = item.split(propertyDelimiterRE);
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
}
});
return ret;
}
function stringifyStyle(styles) {
let ret = "";
if (!styles || isString(styles)) {
return ret;
}
for (const key in styles) {
const value = styles[key];
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
if (isString(value) || typeof value === "number") {
ret += `${normalizedKey}:${value};`;
}
}
return ret;
}
function normalizeClass(value) {
let res = "";
if (isString(value)) {
res = value;
} else if (isArray(value)) {
for (let i = 0; i < value.length; i++) {
const normalized = normalizeClass(value[i]);
if (normalized) {
res += normalized + " ";
}
}
} else if (isObject(value)) {
for (const name in value) {
if (value[name]) {
res += name + " ";
}
}
}
return res.trim();
}
function normalizeProps(props) {
if (!props)
return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
}
if (style) {
props.style = normalizeStyle(style);
}
return props;
}
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
const isBooleanAttr = /* @__PURE__ */ makeMap(
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
);
function includeBooleanAttr(value) {
return !!value || value === "";
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
const attrValidationCache = {};
function isSSRSafeAttrName(name) {
if (attrValidationCache.hasOwnProperty(name)) {
return attrValidationCache[name];
}
const isUnsafe = unsafeAttrCharRE.test(name);
if (isUnsafe) {
console.error(`unsafe attribute name: ${name}`);
}
return attrValidationCache[name] = !isUnsafe;
}
const propsToAttrMap = {
acceptCharset: "accept-charset",
className: "class",
htmlFor: "for",
httpEquiv: "http-equiv"
};
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
);
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
const escapeRE = /["'&<>]/;
function escapeHtml(string) {
const str = "" + string;
const match = escapeRE.exec(str);
if (!match) {
return str;
}
let html = "";
let escaped;
let index;
let lastIndex = 0;
for (index = match.index; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34:
escaped = "&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]) => {
entries[`${key} =>`] = val2;
return entries;
}, {})
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()]
};
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.PatchFlagNames = PatchFlagNames;
exports.camelize = camelize;
exports.capitalize = capitalize;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getGlobalThis = getGlobalThis;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
exports.hyphenate = hyphenate;
exports.includeBooleanAttr = includeBooleanAttr;
exports.invokeArrayFns = invokeArrayFns;
exports.isArray = isArray;
exports.isBooleanAttr = isBooleanAttr;
exports.isBuiltInDirective = isBuiltInDirective;
exports.isDate = isDate;
exports.isFunction = isFunction;
exports.isGloballyAllowed = isGloballyAllowed;
exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;
exports.isModelListener = isModelListener;
exports.isObject = isObject;
exports.isOn = isOn;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isReservedProp = isReservedProp;
exports.isSSRSafeAttrName = isSSRSafeAttrName;
exports.isSVGTag = isSVGTag;
exports.isSet = isSet;
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
exports.isString = isString;
exports.isSymbol = isSymbol;
exports.isVoidTag = isVoidTag;
exports.looseEqual = looseEqual;
exports.looseIndexOf = looseIndexOf;
exports.looseToNumber = looseToNumber;
exports.makeMap = makeMap;
exports.normalizeClass = normalizeClass;
exports.normalizeProps = normalizeProps;
exports.normalizeStyle = normalizeStyle;
exports.objectToString = objectToString;
exports.parseStringStyle = parseStringStyle;
exports.propsToAttrMap = propsToAttrMap;
exports.remove = remove;
exports.slotFlagsText = slotFlagsText;
exports.stringifyStyle = stringifyStyle;
exports.toDisplayString = toDisplayString;
exports.toHandlerKey = toHandlerKey;
exports.toNumber = toNumber;
exports.toRawType = toRawType;
exports.toTypeString = toTypeString;

View File

@@ -1,14 +1,18 @@
/**
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
const list = str.split(",");
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
const EMPTY_OBJ = {};
@@ -16,8 +20,8 @@ const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const onRE = /^on[^a-z]/;
const isOn = (key) => onRE.test(key);
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) => {
@@ -62,9 +66,11 @@ const cacheStringFunction = (fn) => {
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
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()
@@ -72,20 +78,23 @@ const hyphenate = cacheStringFunction(
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 toHandlerKey = cacheStringFunction(
(str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
}
);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {
const invokeArrayFns = (fns, ...arg) => {
for (let i = 0; i < fns.length; i++) {
fns[i](arg);
fns[i](...arg);
}
};
const def = (obj, key, value) => {
const def = (obj, key, value, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
@@ -105,7 +114,43 @@ 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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(
options,
(_, val) => typeof val === "function" ? val.toString() : val
);
}
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",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
const PatchFlagNames = {
[1]: `TEXT`,
[2]: `CLASS`,
@@ -123,18 +168,54 @@ const PatchFlagNames = {
[-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";
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,Symbol";
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
const isGloballyWhitelisted = isGloballyAllowed;
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -144,8 +225,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
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;
if (j < 0 || j >= lines.length) continue;
const line = j + 1;
res.push(
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -204,14 +284,13 @@ function parseStringStyle(cssText) {
return ret;
}
function stringifyStyle(styles) {
if (!styles) return "";
if (isString(styles)) return 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") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
ret += `${normalizedKey}:${value};`;
}
}
@@ -238,8 +317,7 @@ function normalizeClass(value) {
return res.trim();
}
function normalizeProps(props) {
if (!props)
return null;
if (!props) return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
@@ -252,9 +330,11 @@ function normalizeProps(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`;
@@ -287,8 +367,18 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
);
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
`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 isKnownMathMLAttr = /* @__PURE__ */ makeMap(
`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
}
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
const escapeRE = /["'&<>]/;
function escapeHtml(string) {
@@ -333,10 +423,16 @@ const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
function escapeHtmlComment(src) {
return src.replace(commentStripRE, "");
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(
cssVarNameEscapeSymbolsRE,
(s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
);
}
function looseCompareArrays(a, b) {
if (a.length !== b.length)
return false;
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]);
@@ -344,8 +440,7 @@ function looseCompareArrays(a, b) {
return equal;
}
function looseEqual(a, b) {
if (a === b)
return true;
if (a === b) return true;
let aValidType = isDate(a);
let bValidType = isDate(b);
if (aValidType || bValidType) {
@@ -386,42 +481,64 @@ function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
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);
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
if (isRef(val)) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
entries[`${key} =>`] = val2;
return entries;
}, {})
[`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()]
[`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 (
// Symbol.description in es2019+ so we need to cast here to pass
// the lib: es2016 check
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.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genCacheKey = genCacheKey;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getEscapedCssVarName = getEscapedCssVarName;
exports.getGlobalThis = getGlobalThis;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
@@ -438,14 +555,17 @@ exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownMathMLAttr = isKnownMathMLAttr;
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;

View File

@@ -1,7 +0,0 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/shared.cjs.prod.js')
} else {
module.exports = require('./dist/shared.cjs.js')
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/shared",
"version": "3.3.9",
"version": "3.5.13",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
@@ -9,6 +9,20 @@
"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": [
@@ -29,5 +43,8 @@
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme",
"__npminstall_done": true,
"_from": "@vue/shared@3.5.13",
"_resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.5.13.tgz"
}

View File

@@ -59,5 +59,8 @@
"tap-spec": "^4.1.1",
"tape": "^4.5.1"
},
"dependencies": {}
"dependencies": {},
"__npminstall_done": true,
"_from": "asynckit@0.4.0",
"_resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz"
}

View File

@@ -1,11 +1,13 @@
import utils from '../utils.js';
import httpAdapter from './http.js';
import xhrAdapter from './xhr.js';
import fetchAdapter from './fetch.js';
import AxiosError from "../core/AxiosError.js";
const knownAdapters = {
http: httpAdapter,
xhr: xhrAdapter
xhr: xhrAdapter,
fetch: fetchAdapter
}
utils.forEach(knownAdapters, (fn, value) => {

229
.output/server/node_modules/axios/lib/adapters/fetch.js generated vendored Normal file
View File

@@ -0,0 +1,229 @@
import platform from "../platform/index.js";
import utils from "../utils.js";
import AxiosError from "../core/AxiosError.js";
import composeSignals from "../helpers/composeSignals.js";
import {trackStream} from "../helpers/trackStream.js";
import AxiosHeaders from "../core/AxiosHeaders.js";
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
import resolveConfig from "../helpers/resolveConfig.js";
import settle from "../core/settle.js";
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
// used only inside the fetch adapter
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
);
const test = (fn, ...args) => {
try {
return !!fn(...args);
} catch (e) {
return false
}
}
const supportsRequestStream = isReadableStreamSupported && test(() => {
let duplexAccessed = false;
const hasContentType = new Request(platform.origin, {
body: new ReadableStream(),
method: 'POST',
get duplex() {
duplexAccessed = true;
return 'half';
},
}).headers.has('Content-Type');
return duplexAccessed && !hasContentType;
});
const DEFAULT_CHUNK_SIZE = 64 * 1024;
const supportsResponseStream = isReadableStreamSupported &&
test(() => utils.isReadableStream(new Response('').body));
const resolvers = {
stream: supportsResponseStream && ((res) => res.body)
};
isFetchSupported && (((res) => {
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
!resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :
(_, config) => {
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
})
});
})(new Response));
const getBodyLength = async (body) => {
if (body == null) {
return 0;
}
if(utils.isBlob(body)) {
return body.size;
}
if(utils.isSpecCompliantForm(body)) {
const _request = new Request(platform.origin, {
method: 'POST',
body,
});
return (await _request.arrayBuffer()).byteLength;
}
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
return body.byteLength;
}
if(utils.isURLSearchParams(body)) {
body = body + '';
}
if(utils.isString(body)) {
return (await encodeText(body)).byteLength;
}
}
const resolveBodyLength = async (headers, body) => {
const length = utils.toFiniteNumber(headers.getContentLength());
return length == null ? getBodyLength(body) : length;
}
export default isFetchSupported && (async (config) => {
let {
url,
method,
data,
signal,
cancelToken,
timeout,
onDownloadProgress,
onUploadProgress,
responseType,
headers,
withCredentials = 'same-origin',
fetchOptions
} = resolveConfig(config);
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
let request;
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
composedSignal.unsubscribe();
});
let requestContentLength;
try {
if (
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
) {
let _request = new Request(url, {
method: 'POST',
body: data,
duplex: "half"
});
let contentTypeHeader;
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
headers.setContentType(contentTypeHeader)
}
if (_request.body) {
const [onProgress, flush] = progressEventDecorator(
requestContentLength,
progressEventReducer(asyncDecorator(onUploadProgress))
);
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
}
}
if (!utils.isString(withCredentials)) {
withCredentials = withCredentials ? 'include' : 'omit';
}
// Cloudflare Workers throws when credentials are defined
// see https://github.com/cloudflare/workerd/issues/902
const isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, {
...fetchOptions,
signal: composedSignal,
method: method.toUpperCase(),
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: isCredentialsSupported ? withCredentials : undefined
});
let response = await fetch(request);
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
const options = {};
['status', 'statusText', 'headers'].forEach(prop => {
options[prop] = response[prop];
});
const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
responseContentLength,
progressEventReducer(asyncDecorator(onDownloadProgress), true)
) || [];
response = new Response(
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush();
unsubscribe && unsubscribe();
}),
options
);
}
responseType = responseType || 'text';
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
!isStreamResponse && unsubscribe && unsubscribe();
return await new Promise((resolve, reject) => {
settle(resolve, reject, {
data: responseData,
headers: AxiosHeaders.from(response.headers),
status: response.status,
statusText: response.statusText,
config,
request
})
})
} catch (err) {
unsubscribe && unsubscribe();
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
throw Object.assign(
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
{
cause: err.cause || err
}
)
}
throw AxiosError.from(err, err && err.code, config, request);
}
});

View File

@@ -4,7 +4,7 @@ import utils from './../utils.js';
import settle from './../core/settle.js';
import buildFullPath from '../core/buildFullPath.js';
import buildURL from './../helpers/buildURL.js';
import {getProxyForUrl} from 'proxy-from-env';
import proxyFromEnv from 'proxy-from-env';
import http from 'http';
import https from 'https';
import util from 'util';
@@ -19,11 +19,12 @@ import fromDataURI from '../helpers/fromDataURI.js';
import stream from 'stream';
import AxiosHeaders from '../core/AxiosHeaders.js';
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
import EventEmitter from 'events';
import {EventEmitter} from 'events';
import formDataToStream from "../helpers/formDataToStream.js";
import readBlob from "../helpers/readBlob.js";
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
import callbackify from "../helpers/callbackify.js";
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
const zlibOptions = {
flush: zlib.constants.Z_SYNC_FLUSH,
@@ -45,6 +46,14 @@ const supportedProtocols = platform.protocols.map(protocol => {
return protocol + ':';
});
const flushOnFinish = (stream, [throttled, flush]) => {
stream
.on('end', flush)
.on('error', flush);
return throttled;
}
/**
* If the proxy or config beforeRedirects functions are defined, call them with the options
* object.
@@ -53,12 +62,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);
}
}
@@ -74,7 +83,7 @@ function dispatchBeforeRedirect(options) {
function setProxy(options, configProxy, location) {
let proxy = configProxy;
if (!proxy && proxy !== false) {
const proxyUrl = getProxyForUrl(location);
const proxyUrl = proxyFromEnv.getProxyForUrl(location);
if (proxyUrl) {
proxy = new URL(proxyUrl);
}
@@ -171,6 +180,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);
@@ -215,8 +228,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
}
// Parse url
const fullPath = buildFullPath(config.baseURL, config.url);
const parsed = new URL(fullPath, 'http://localhost');
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
const protocol = parsed.protocol || supportedProtocols[0];
if (protocol === 'data:') {
@@ -274,8 +287,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
// Only set header if it hasn't been set in config
headers.set('User-Agent', 'axios/' + VERSION, false);
const onDownloadProgress = config.onDownloadProgress;
const onUploadProgress = config.onUploadProgress;
const {onUploadProgress, onDownloadProgress} = config;
const maxRate = config.maxRate;
let maxUploadRate = undefined;
let maxDownloadRate = undefined;
@@ -302,7 +314,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
} catch (e) {
}
}
} else if (utils.isBlob(data)) {
} else if (utils.isBlob(data) || utils.isFile(data)) {
data.size && headers.setContentType(data.type || 'application/octet-stream');
headers.setContentLength(data.size || 0);
data = stream.Readable.from(readBlob(data));
@@ -348,15 +360,16 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
}
data = stream.pipeline([data, new AxiosTransformStream({
length: contentLength,
maxRate: utils.toFiniteNumber(maxUploadRate)
})], utils.noop);
onUploadProgress && data.on('progress', progress => {
onUploadProgress(Object.assign(progress, {
upload: true
}));
});
onUploadProgress && data.on('progress', flushOnFinish(
data,
progressEventDecorator(
contentLength,
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
)
));
}
// HTTP basic authentication
@@ -414,7 +427,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
if (config.socketPath) {
options.socketPath = config.socketPath;
} else {
options.hostname = parsed.hostname;
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
options.port = parsed.port;
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
}
@@ -455,17 +468,18 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
const responseLength = +res.headers['content-length'];
if (onDownloadProgress) {
if (onDownloadProgress || maxDownloadRate) {
const transformStream = new AxiosTransformStream({
length: utils.toFiniteNumber(responseLength),
maxRate: utils.toFiniteNumber(maxDownloadRate)
});
onDownloadProgress && transformStream.on('progress', progress => {
onDownloadProgress(Object.assign(progress, {
download: true
}));
});
onDownloadProgress && transformStream.on('progress', flushOnFinish(
transformStream,
progressEventDecorator(
responseLength,
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
)
));
streams.push(transformStream);
}
@@ -555,7 +569,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
}
const err = new AxiosError(
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
'stream has been aborted',
AxiosError.ERR_BAD_RESPONSE,
config,
lastRequest

View File

@@ -1,93 +1,41 @@
'use strict';
import utils from './../utils.js';
import settle from './../core/settle.js';
import cookies from './../helpers/cookies.js';
import buildURL from './../helpers/buildURL.js';
import buildFullPath from '../core/buildFullPath.js';
import isURLSameOrigin from './../helpers/isURLSameOrigin.js';
import transitionalDefaults from '../defaults/transitional.js';
import AxiosError from '../core/AxiosError.js';
import CanceledError from '../cancel/CanceledError.js';
import parseProtocol from '../helpers/parseProtocol.js';
import platform from '../platform/index.js';
import AxiosHeaders from '../core/AxiosHeaders.js';
import speedometer from '../helpers/speedometer.js';
function progressEventReducer(listener, isDownloadStream) {
let bytesNotified = 0;
const _speedometer = speedometer(50, 250);
return e => {
const loaded = e.loaded;
const total = e.lengthComputable ? e.total : undefined;
const progressBytes = loaded - bytesNotified;
const rate = _speedometer(progressBytes);
const inRange = loaded <= total;
bytesNotified = loaded;
const data = {
loaded,
total,
progress: total ? (loaded / total) : undefined,
bytes: progressBytes,
rate: rate ? rate : undefined,
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
event: e
};
data[isDownloadStream ? 'download' : 'upload'] = true;
listener(data);
};
}
import {progressEventReducer} from '../helpers/progressEventReducer.js';
import resolveConfig from "../helpers/resolveConfig.js";
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
export default isXHRAdapterSupported && function (config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
let requestData = config.data;
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
let {responseType, withXSRFToken} = config;
const _config = resolveConfig(config);
let requestData = _config.data;
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
let {responseType, onUploadProgress, onDownloadProgress} = _config;
let onCanceled;
let uploadThrottled, downloadThrottled;
let flushUpload, flushDownload;
function done() {
if (config.cancelToken) {
config.cancelToken.unsubscribe(onCanceled);
}
flushUpload && flushUpload(); // flush events
flushDownload && flushDownload(); // flush events
if (config.signal) {
config.signal.removeEventListener('abort', onCanceled);
}
}
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
let contentType;
if (utils.isFormData(requestData)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else if ((contentType = requestHeaders.getContentType()) !== false) {
// fix semicolon duplication issue for ReactNative FormData implementation
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
}
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
}
let request = new XMLHttpRequest();
// HTTP basic authentication
if (config.auth) {
const username = config.auth.username || '';
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
}
const fullPath = buildFullPath(config.baseURL, config.url);
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
request.open(_config.method.toUpperCase(), _config.url, true);
// Set the request timeout in MS
request.timeout = config.timeout;
request.timeout = _config.timeout;
function onloadend() {
if (!request) {
@@ -167,10 +115,10 @@ export default isXHRAdapterSupported && function (config) {
// Handle timeout
request.ontimeout = function handleTimeout() {
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
const transitional = config.transitional || transitionalDefaults;
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
const transitional = _config.transitional || transitionalDefaults;
if (_config.timeoutErrorMessage) {
timeoutErrorMessage = _config.timeoutErrorMessage;
}
reject(new AxiosError(
timeoutErrorMessage,
@@ -182,22 +130,6 @@ export default isXHRAdapterSupported && function (config) {
request = null;
};
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if(platform.hasStandardBrowserEnv) {
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
// Add xsrf header
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
}
}
}
// Remove Content-Type if data is undefined
requestData === undefined && requestHeaders.setContentType(null);
@@ -209,26 +141,31 @@ export default isXHRAdapterSupported && function (config) {
}
// Add withCredentials to request if needed
if (!utils.isUndefined(config.withCredentials)) {
request.withCredentials = !!config.withCredentials;
if (!utils.isUndefined(_config.withCredentials)) {
request.withCredentials = !!_config.withCredentials;
}
// Add responseType to request if needed
if (responseType && responseType !== 'json') {
request.responseType = config.responseType;
request.responseType = _config.responseType;
}
// Handle progress if needed
if (typeof config.onDownloadProgress === 'function') {
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
if (onDownloadProgress) {
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
request.addEventListener('progress', downloadThrottled);
}
// Not all browsers support upload events
if (typeof config.onUploadProgress === 'function' && request.upload) {
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
if (onUploadProgress && request.upload) {
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
request.upload.addEventListener('progress', uploadThrottled);
request.upload.addEventListener('loadend', flushUpload);
}
if (config.cancelToken || config.signal) {
if (_config.cancelToken || _config.signal) {
// Handle cancellation
// eslint-disable-next-line func-names
onCanceled = cancel => {
@@ -240,13 +177,13 @@ export default isXHRAdapterSupported && function (config) {
request = null;
};
config.cancelToken && config.cancelToken.subscribe(onCanceled);
if (config.signal) {
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
if (_config.signal) {
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
}
}
const protocol = parseProtocol(fullPath);
const protocol = parseProtocol(_config.url);
if (protocol && platform.protocols.indexOf(protocol) === -1) {
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));

View File

@@ -102,6 +102,20 @@ class CancelToken {
}
}
toAbortSignal() {
const controller = new AbortController();
const abort = (err) => {
controller.abort(err);
};
this.subscribe(abort);
controller.signal.unsubscribe = () => this.unsubscribe(abort);
return controller.signal;
}
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.

View File

@@ -35,7 +35,34 @@ 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/, '') : '';
try {
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
}
} catch (e) {
// ignore the case where "stack" is an un-writable property
}
}
throw err;
}
}
_request(configOrUrl, config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof configOrUrl === 'string') {
@@ -70,6 +97,20 @@ class Axios {
}
}
// Set config.allowAbsoluteUrls
if (config.allowAbsoluteUrls !== undefined) {
// do nothing
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
} else {
config.allowAbsoluteUrls = true;
}
validator.assertOptions(config, {
baseUrl: validators.spelling('baseURL'),
withXsrfToken: validators.spelling('withXSRFToken')
}, true);
// Set config.method
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
@@ -160,7 +201,7 @@ class Axios {
getUri(config) {
config = mergeConfig(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url);
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
}

View File

@@ -27,7 +27,10 @@ function AxiosError(message, code, config, request, response) {
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
response && (this.response = response);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils.inherits(AxiosError, Error, {
@@ -47,7 +50,7 @@ utils.inherits(AxiosError, Error, {
// Axios
config: utils.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
status: this.status
};
}
});

View File

@@ -100,6 +100,10 @@ class AxiosHeaders {
setHeaders(header, valueOrRewrite)
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
} else if (utils.isHeaders(header)) {
for (const [key, value] of header.entries()) {
setHeader(value, key, rewrite);
}
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
}

View File

@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
*
* @returns {string} The combined full path
*/
export default function buildFullPath(baseURL, requestedURL) {
if (baseURL && !isAbsoluteURL(requestedURL)) {
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
let isRelativeUrl = !isAbsoluteURL(requestedURL);
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
return combineURLs(baseURL, requestedURL);
}
return requestedURL;

View File

@@ -3,7 +3,7 @@
import utils from '../utils.js';
import AxiosHeaders from "./AxiosHeaders.js";
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
/**
* Config-specific merge-function which creates a new config-object
@@ -19,7 +19,7 @@ export default function mergeConfig(config1, config2) {
config2 = config2 || {};
const config = {};
function getMergedValue(target, source, caseless) {
function getMergedValue(target, source, prop, caseless) {
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
return utils.merge.call({caseless}, target, source);
} else if (utils.isPlainObject(source)) {
@@ -31,11 +31,11 @@ export default function mergeConfig(config1, config2) {
}
// eslint-disable-next-line consistent-return
function mergeDeepProperties(a, b, caseless) {
function mergeDeepProperties(a, b, prop , caseless) {
if (!utils.isUndefined(b)) {
return getMergedValue(a, b, caseless);
return getMergedValue(a, b, prop , caseless);
} else if (!utils.isUndefined(a)) {
return getMergedValue(undefined, a, caseless);
return getMergedValue(undefined, a, prop , caseless);
}
}
@@ -93,7 +93,7 @@ export default function mergeConfig(config1, config2) {
socketPath: defaultToConfig2,
responseEncoding: defaultToConfig2,
validateStatus: mergeDirectKeys,
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
};
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {

View File

@@ -37,7 +37,7 @@ const defaults = {
transitional: transitionalDefaults,
adapter: ['xhr', 'http'],
adapter: ['xhr', 'http', 'fetch'],
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
@@ -51,9 +51,6 @@ const defaults = {
const isFormData = utils.isFormData(data);
if (isFormData) {
if (!hasJSONContentType) {
return data;
}
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
@@ -61,7 +58,8 @@ const defaults = {
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
utils.isBlob(data) ||
utils.isReadableStream(data)
) {
return data;
}
@@ -104,6 +102,10 @@ const defaults = {
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
const JSONRequested = this.responseType === 'json';
if (utils.isResponse(data) || utils.isReadableStream(data)) {
return data;
}
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
const silentJSONParsing = transitional && transitional.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;

View File

@@ -1 +1 @@
export const VERSION = "1.6.2";
export const VERSION = "1.8.3";

View File

@@ -2,8 +2,6 @@
import stream from 'stream';
import utils from '../utils.js';
import throttle from './throttle.js';
import speedometer from './speedometer.js';
const kInternals = Symbol('internals');
@@ -24,12 +22,8 @@ class AxiosTransformStream extends stream.Transform{
readableHighWaterMark: options.chunkSize
});
const self = this;
const internals = this[kInternals] = {
length: options.length,
timeWindow: options.timeWindow,
ticksRate: options.ticksRate,
chunkSize: options.chunkSize,
maxRate: options.maxRate,
minChunkSize: options.minChunkSize,
@@ -41,8 +35,6 @@ class AxiosTransformStream extends stream.Transform{
onReadCallback: null
};
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
this.on('newListener', event => {
if (event === 'progress') {
if (!internals.isCaptured) {
@@ -50,38 +42,6 @@ class AxiosTransformStream extends stream.Transform{
}
}
});
let bytesNotified = 0;
internals.updateProgress = throttle(function throttledHandler() {
const totalBytes = internals.length;
const bytesTransferred = internals.bytesSeen;
const progressBytes = bytesTransferred - bytesNotified;
if (!progressBytes || self.destroyed) return;
const rate = _speedometer(progressBytes);
bytesNotified = bytesTransferred;
process.nextTick(() => {
self.emit('progress', {
'loaded': bytesTransferred,
'total': totalBytes,
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
'bytes': progressBytes,
'rate': rate ? rate : undefined,
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
(totalBytes - bytesTransferred) / rate : undefined
});
});
}, internals.ticksRate);
const onFinish = () => {
internals.updateProgress(true);
};
this.once('end', onFinish);
this.once('error', onFinish);
}
_read(size) {
@@ -95,7 +55,6 @@ class AxiosTransformStream extends stream.Transform{
}
_transform(chunk, encoding, callback) {
const self = this;
const internals = this[kInternals];
const maxRate = internals.maxRate;
@@ -107,16 +66,14 @@ class AxiosTransformStream extends stream.Transform{
const bytesThreshold = (maxRate / divider);
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
function pushChunk(_chunk, _callback) {
const pushChunk = (_chunk, _callback) => {
const bytes = Buffer.byteLength(_chunk);
internals.bytesSeen += bytes;
internals.bytes += bytes;
if (internals.isCaptured) {
internals.updateProgress();
}
internals.isCaptured && this.emit('progress', internals.bytesSeen);
if (self.push(_chunk)) {
if (this.push(_chunk)) {
process.nextTick(_callback);
} else {
internals.onReadCallback = () => {
@@ -181,11 +138,6 @@ class AxiosTransformStream extends stream.Transform{
}
});
}
setLength(length) {
this[kInternals].length = +length;
return this;
}
}
export default AxiosTransformStream;

View File

@@ -26,7 +26,7 @@ function encode(val) {
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @param {?object} options
* @param {?(object|Function)} options
*
* @returns {string} The formatted url
*/
@@ -38,6 +38,12 @@ export default function buildURL(url, params, options) {
const _encode = options && options.encode || encode;
if (utils.isFunction(options)) {
options = {
serialize: options
};
}
const serializeFn = options && options.serialize;
let serializedParams;

View File

@@ -10,6 +10,6 @@
*/
export default function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
: baseURL;
}

View File

@@ -0,0 +1,48 @@
import CanceledError from "../cancel/CanceledError.js";
import AxiosError from "../core/AxiosError.js";
import utils from '../utils.js';
const composeSignals = (signals, timeout) => {
const {length} = (signals = signals ? signals.filter(Boolean) : []);
if (timeout || length) {
let controller = new AbortController();
let aborted;
const onabort = function (reason) {
if (!aborted) {
aborted = true;
unsubscribe();
const err = reason instanceof Error ? reason : this.reason;
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
}
}
let timer = timeout && setTimeout(() => {
timer = null;
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))
}, timeout)
const unsubscribe = () => {
if (signals) {
timer && clearTimeout(timer);
timer = null;
signals.forEach(signal => {
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
});
signals = null;
}
}
signals.forEach((signal) => signal.addEventListener('abort', onabort));
const {signal} = controller;
signal.unsubscribe = () => utils.asap(unsubscribe);
return signal;
}
}
export default composeSignals;

View File

@@ -49,6 +49,9 @@ function arrayToObject(arr) {
function formDataToJSON(formData) {
function buildPath(path, value, target, index) {
let name = path[index++];
if (name === '__proto__') return true;
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path.length;
name = !name && utils.isArray(target) ? target.length : name;

View File

@@ -1,11 +1,12 @@
import {TextEncoder} from 'util';
import util from 'util';
import {Readable} from 'stream';
import utils from "../utils.js";
import readBlob from "./readBlob.js";
import platform from "../platform/index.js";
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
const textEncoder = new TextEncoder();
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
const CRLF = '\r\n';
const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -63,7 +64,7 @@ const formDataToStream = (form, headersHandler, options) => {
const {
tag = 'form-data-boundary',
size = 25,
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
} = options || {};
if(!utils.isFormData(form)) {

View File

@@ -1,67 +1,14 @@
'use strict';
import utils from './../utils.js';
import platform from '../platform/index.js';
export default platform.hasStandardBrowserEnv ?
export default platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
url = new URL(url, platform.origin);
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
const msie = /(msie|trident)/i.test(navigator.userAgent);
const urlParsingNode = document.createElement('a');
let originURL;
/**
* Parse a URL to discover its components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {
let href = url;
if (msie) {
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href;
}
urlParsingNode.setAttribute('href', href);
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
return {
href: urlParsingNode.href,
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
host: urlParsingNode.host,
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
hostname: urlParsingNode.hostname,
port: urlParsingNode.port,
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
urlParsingNode.pathname :
'/' + urlParsingNode.pathname
};
}
originURL = resolveURL(window.location.href);
/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
})() :
// Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return function isURLSameOrigin() {
return true;
};
})();
return (
origin.protocol === url.protocol &&
origin.host === url.host &&
(isMSIE || origin.port === url.port)
);
})(
new URL(platform.origin),
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => true;

View File

@@ -0,0 +1,44 @@
import speedometer from "./speedometer.js";
import throttle from "./throttle.js";
import utils from "../utils.js";
export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
let bytesNotified = 0;
const _speedometer = speedometer(50, 250);
return throttle(e => {
const loaded = e.loaded;
const total = e.lengthComputable ? e.total : undefined;
const progressBytes = loaded - bytesNotified;
const rate = _speedometer(progressBytes);
const inRange = loaded <= total;
bytesNotified = loaded;
const data = {
loaded,
total,
progress: total ? (loaded / total) : undefined,
bytes: progressBytes,
rate: rate ? rate : undefined,
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
event: e,
lengthComputable: total != null,
[isDownloadStream ? 'download' : 'upload']: true
};
listener(data);
}, freq);
}
export const progressEventDecorator = (total, throttled) => {
const lengthComputable = total != null;
return [(loaded) => throttled[0]({
lengthComputable,
total,
loaded
}), throttled[1]];
}
export const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));

View File

@@ -0,0 +1,57 @@
import platform from "../platform/index.js";
import utils from "../utils.js";
import isURLSameOrigin from "./isURLSameOrigin.js";
import cookies from "./cookies.js";
import buildFullPath from "../core/buildFullPath.js";
import mergeConfig from "../core/mergeConfig.js";
import AxiosHeaders from "../core/AxiosHeaders.js";
import buildURL from "./buildURL.js";
export default (config) => {
const newConfig = mergeConfig({}, config);
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
newConfig.headers = headers = AxiosHeaders.from(headers);
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
// HTTP basic authentication
if (auth) {
headers.set('Authorization', 'Basic ' +
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
);
}
let contentType;
if (utils.isFormData(data)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
headers.setContentType(undefined); // Let the browser set it
} else if ((contentType = headers.getContentType()) !== false) {
// fix semicolon duplication issue for ReactNative FormData implementation
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
}
}
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if (platform.hasStandardBrowserEnv) {
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
// Add xsrf header
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
if (xsrfValue) {
headers.set(xsrfHeaderName, xsrfValue);
}
}
}
return newConfig;
}

View File

@@ -1,5 +1,3 @@
'use strict';
/**
* Throttle decorator
* @param {Function} fn
@@ -8,26 +6,39 @@
*/
function throttle(fn, freq) {
let timestamp = 0;
const threshold = 1000 / freq;
let timer = null;
return function throttled(force, args) {
let threshold = 1000 / freq;
let lastArgs;
let timer;
const invoke = (args, now = Date.now()) => {
timestamp = now;
lastArgs = null;
if (timer) {
clearTimeout(timer);
timer = null;
}
fn.apply(null, args);
}
const throttled = (...args) => {
const now = Date.now();
if (force || now - timestamp > threshold) {
if (timer) {
clearTimeout(timer);
timer = null;
const passed = now - timestamp;
if ( passed >= threshold) {
invoke(args, now);
} else {
lastArgs = args;
if (!timer) {
timer = setTimeout(() => {
timer = null;
invoke(lastArgs)
}, threshold - passed);
}
timestamp = now;
return fn.apply(null, args);
}
if (!timer) {
timer = setTimeout(() => {
timer = null;
timestamp = Date.now();
return fn.apply(null, args);
}, threshold - (now - timestamp));
}
};
}
const flush = () => lastArgs && invoke(lastArgs);
return [throttled, flush];
}
export default throttle;

View File

@@ -0,0 +1,87 @@
export const streamChunk = function* (chunk, chunkSize) {
let len = chunk.byteLength;
if (!chunkSize || len < chunkSize) {
yield chunk;
return;
}
let pos = 0;
let end;
while (pos < len) {
end = pos + chunkSize;
yield chunk.slice(pos, end);
pos = end;
}
}
export const readBytes = async function* (iterable, chunkSize) {
for await (const chunk of readStream(iterable)) {
yield* streamChunk(chunk, chunkSize);
}
}
const readStream = async function* (stream) {
if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (;;) {
const {done, value} = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
}
export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator = readBytes(stream, chunkSize);
let bytes = 0;
let done;
let _onFinish = (e) => {
if (!done) {
done = true;
onFinish && onFinish(e);
}
}
return new ReadableStream({
async pull(controller) {
try {
const {done, value} = await iterator.next();
if (done) {
_onFinish();
controller.close();
return;
}
let len = value.byteLength;
if (onProgress) {
let loadedBytes = bytes += len;
onProgress(loadedBytes);
}
controller.enqueue(new Uint8Array(value));
} catch (err) {
_onFinish(err);
throw err;
}
},
cancel(reason) {
_onFinish(reason);
return iterator.return();
}
}, {
highWaterMark: 2
})
}

View File

@@ -52,6 +52,14 @@ validators.transitional = function transitional(validator, version, message) {
};
};
validators.spelling = function spelling(correctSpelling) {
return (value, opt) => {
// eslint-disable-next-line no-console
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
return true;
}
};
/**
* Assert object's properties type
*

View File

@@ -1,5 +1,7 @@
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
const _navigator = typeof navigator === 'object' && navigator || undefined;
/**
* Determine if we're running in a standard browser environment
*
@@ -17,10 +19,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
*
* @returns {boolean}
*/
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
const hasStandardBrowserEnv = hasBrowserEnv &&
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
/**
* Determine if we're running in a standard browser webWorker environment
@@ -40,8 +40,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
);
})();
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
export {
hasBrowserEnv,
hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv
hasStandardBrowserEnv,
_navigator as navigator,
origin
}

View File

@@ -1,6 +1,30 @@
import crypto from 'crypto';
import URLSearchParams from './classes/URLSearchParams.js'
import FormData from './classes/FormData.js'
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
const DIGIT = '0123456789';
const ALPHABET = {
DIGIT,
ALPHA,
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
}
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
let str = '';
const {length} = alphabet;
const randomValues = new Uint32Array(size);
crypto.randomFillSync(randomValues);
for (let i = 0; i < size; i++) {
str += alphabet[randomValues[i] % length];
}
return str;
}
export default {
isNode: true,
classes: {
@@ -8,5 +32,7 @@ export default {
FormData,
Blob: typeof Blob !== 'undefined' && Blob || null
},
ALPHABET,
generateString,
protocols: [ 'http', 'https', 'file', 'data' ]
};

View File

@@ -209,6 +209,8 @@ const isFormData = (thing) => {
*/
const isURLSearchParams = kindOfTest('URLSearchParams');
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
/**
* Trim excess whitespace off the beginning and end of a string
*
@@ -597,28 +599,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
const noop = () => {}
const toFiniteNumber = (value, defaultValue) => {
value = +value;
return Number.isFinite(value) ? value : defaultValue;
}
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
const DIGIT = '0123456789';
const ALPHABET = {
DIGIT,
ALPHA,
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
}
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
let str = '';
const {length} = alphabet;
while (size--) {
str += alphabet[Math.random() * length|0]
}
return str;
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
}
/**
@@ -668,6 +649,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
const isThenable = (thing) =>
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
// original code
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
if (setImmediateSupported) {
return setImmediate;
}
return postMessageSupported ? ((token, callbacks) => {
_global.addEventListener("message", ({source, data}) => {
if (source === _global && data === token) {
callbacks.length && callbacks.shift()();
}
}, false);
return (cb) => {
callbacks.push(cb);
_global.postMessage(token, "*");
}
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
})(
typeof setImmediate === 'function',
isFunction(_global.postMessage)
);
const asap = typeof queueMicrotask !== 'undefined' ?
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
// *********************
export default {
isArray,
isArrayBuffer,
@@ -679,6 +690,10 @@ export default {
isBoolean,
isObject,
isPlainObject,
isReadableStream,
isRequest,
isResponse,
isHeaders,
isUndefined,
isDate,
isFile,
@@ -714,10 +729,10 @@ export default {
findKey,
global: _global,
isContextDefined,
ALPHABET,
generateString,
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
isThenable
isThenable,
setImmediate: _setImmediate,
asap
};

View File

@@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.6.2",
"version": "1.8.3",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {
@@ -80,41 +80,41 @@
},
"homepage": "https://axios-http.com",
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@release-it/conventional-changelog": "^5.1.1",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@rollup/plugin-multi-entry": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"abortcontroller-polyfill": "^1.7.3",
"abortcontroller-polyfill": "^1.7.5",
"auto-changelog": "^2.4.0",
"body-parser": "^1.20.0",
"chalk": "^5.2.0",
"body-parser": "^1.20.2",
"chalk": "^5.3.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"dev-null": "^0.1.1",
"dtslint": "^4.2.1",
"es6-promise": "^4.2.8",
"eslint": "^8.17.0",
"express": "^4.18.1",
"formdata-node": "^5.0.0",
"formidable": "^2.0.1",
"eslint": "^8.56.0",
"express": "^4.18.2",
"formdata-node": "^5.0.1",
"formidable": "^2.1.2",
"fs-extra": "^10.1.0",
"get-stream": "^3.0.0",
"gulp": "^4.0.2",
"gzip-size": "^7.0.0",
"handlebars": "^4.7.7",
"husky": "^8.0.2",
"handlebars": "^4.7.8",
"husky": "^8.0.3",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^2.4.1",
"jasmine-core": "^2.99.1",
"karma": "^6.3.17",
"karma-chrome-launcher": "^3.1.1",
"karma-chrome-launcher": "^3.2.0",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^1.1.1",
"karma-jasmine": "^1.1.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-rollup-preprocessor": "^7.0.8",
"karma-safari-launcher": "^1.0.0",
@@ -122,12 +122,12 @@
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.8",
"memoizee": "^0.4.15",
"minimist": "^1.2.7",
"mocha": "^10.0.0",
"minimist": "^1.2.8",
"mocha": "^10.3.0",
"multer": "^1.4.4",
"pretty-bytes": "^6.0.0",
"release-it": "^15.5.1",
"rollup": "^2.67.0",
"pretty-bytes": "^6.1.1",
"release-it": "^15.11.0",
"rollup": "^2.79.1",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-terser": "^7.0.2",
@@ -135,7 +135,8 @@
"stream-throttle": "^0.1.3",
"string-replace-async": "^3.0.2",
"terser-webpack-plugin": "^4.2.3",
"typescript": "^4.8.4"
"typescript": "^4.9.5",
"@rollup/plugin-alias": "^5.1.0"
},
"browser": {
"./lib/adapters/http.js": "./lib/helpers/null.js",
@@ -146,7 +147,7 @@
"unpkg": "dist/axios.min.js",
"typings": "./index.d.ts",
"dependencies": {
"follow-redirects": "^1.15.0",
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
},
@@ -159,8 +160,8 @@
"contributors": [
"Matt Zabriskie (https://github.com/mzabriskie)",
"Nick Uraltsev (https://github.com/nickuraltsev)",
"Jay (https://github.com/jasonsaayman)",
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
"Jay (https://github.com/jasonsaayman)",
"Emily Morehouse (https://github.com/emilyemorehouse)",
"Rubén Norte (https://github.com/rubennorte)",
"Justin Beckwith (https://github.com/JustinBeckwith)",
@@ -214,5 +215,8 @@
"extends": [
"@commitlint/config-conventional"
]
}
},
"__npminstall_done": true,
"_from": "axios@1.8.3",
"_resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.3.tgz"
}

View File

@@ -0,0 +1,10 @@
'use strict';
var bind = require('function-bind');
var $apply = require('./functionApply');
var $call = require('./functionCall');
var $reflectApply = require('./reflectApply');
/** @type {import('./actualApply')} */
module.exports = $reflectApply || bind.call($call, $apply);

View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./functionApply')} */
module.exports = Function.prototype.apply;

View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./functionCall')} */
module.exports = Function.prototype.call;

View File

@@ -0,0 +1,15 @@
'use strict';
var bind = require('function-bind');
var $TypeError = require('es-errors/type');
var $call = require('./functionCall');
var $actualApply = require('./actualApply');
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
module.exports = function callBindBasic(args) {
if (args.length < 1 || typeof args[0] !== 'function') {
throw new $TypeError('a function is required');
}
return $actualApply(bind, $call, args);
};

View File

@@ -0,0 +1,88 @@
{
"name": "call-bind-apply-helpers",
"version": "1.0.2",
"description": "Helper functions around Function call/apply/bind, for use in `call-bind`",
"main": "index.js",
"exports": {
".": "./index.js",
"./actualApply": "./actualApply.js",
"./applyBind": "./applyBind.js",
"./functionApply": "./functionApply.js",
"./functionCall": "./functionCall.js",
"./reflectApply": "./reflectApply.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=auto",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint --ext=.js,.mjs .",
"postlint": "tsc -p . && attw -P",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>=10.2' audit --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/call-bind-apply-helpers.git"
},
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/call-bind-apply-helpers/issues"
},
"homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.3",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.3",
"@types/for-each": "^0.3.3",
"@types/function-bind": "^1.1.10",
"@types/object-inspect": "^1.13.0",
"@types/tape": "^5.8.1",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"es-value-fixtures": "^1.7.1",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.5",
"has-strict-mode": "^1.1.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.4",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"testling": {
"files": "test/index.js"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
},
"__npminstall_done": true,
"_from": "call-bind-apply-helpers@1.0.2",
"_resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz"
}

View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./reflectApply')} */
module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;

View File

@@ -21,5 +21,8 @@
"devDependencies": {
"far": "~0.0.7"
},
"license": "MIT"
"license": "MIT",
"__npminstall_done": true,
"_from": "combined-stream@1.0.8",
"_resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz"
}

View File

@@ -1,6 +1,6 @@
{
"name": "debug",
"version": "4.3.4",
"version": "4.4.0",
"repository": {
"type": "git",
"url": "git://github.com/debug-js/debug.git"
@@ -16,7 +16,7 @@
"LICENSE",
"README.md"
],
"author": "Josh Junon <josh.junon@protonmail.com>",
"author": "Josh Junon (https://github.com/qix-)",
"contributors": [
"TJ Holowaychuk <tj@vision-media.ca>",
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
@@ -26,12 +26,12 @@
"scripts": {
"lint": "xo",
"test": "npm run test:node && npm run test:browser && npm run lint",
"test:node": "istanbul cover _mocha -- test.js",
"test:node": "istanbul cover _mocha -- test.js test.node.js",
"test:browser": "karma start --single-run",
"test:coverage": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"ms": "2.1.2"
"ms": "^2.1.3"
},
"devDependencies": {
"brfs": "^2.0.1",
@@ -44,6 +44,7 @@
"karma-mocha": "^1.3.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.2.0",
"sinon": "^14.0.0",
"xo": "^0.23.0"
},
"peerDependenciesMeta": {
@@ -55,5 +56,13 @@
"browser": "./src/browser.js",
"engines": {
"node": ">=6.0"
}
},
"xo": {
"rules": {
"import/extensions": "off"
}
},
"__npminstall_done": true,
"_from": "debug@4.4.0",
"_resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.0.tgz"
}

View File

@@ -125,14 +125,17 @@ function useColors() {
return false;
}
let m;
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
// eslint-disable-next-line no-return-assign
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}

View File

@@ -166,26 +166,64 @@ function setup(env) {
createDebug.names = [];
createDebug.skips = [];
let i;
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
const len = split.length;
const split = (typeof namespaces === 'string' ? namespaces : '')
.trim()
.replace(' ', ',')
.split(',')
.filter(Boolean);
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
for (const ns of split) {
if (ns[0] === '-') {
createDebug.skips.push(ns.slice(1));
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
createDebug.names.push(ns);
}
}
}
/**
* Checks if the given string matches a namespace template, honoring
* asterisks as wildcards.
*
* @param {String} search
* @param {String} template
* @return {Boolean}
*/
function matchesTemplate(search, template) {
let searchIndex = 0;
let templateIndex = 0;
let starIndex = -1;
let matchIndex = 0;
while (searchIndex < search.length) {
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
// Match character or proceed with wildcard
if (template[templateIndex] === '*') {
starIndex = templateIndex;
matchIndex = searchIndex;
templateIndex++; // Skip the '*'
} else {
searchIndex++;
templateIndex++;
}
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
// Backtrack to the last '*' and try to match more characters
templateIndex = starIndex + 1;
matchIndex++;
searchIndex = matchIndex;
} else {
return false; // No match
}
}
// Handle trailing '*' in template
while (templateIndex < template.length && template[templateIndex] === '*') {
templateIndex++;
}
return templateIndex === template.length;
}
/**
* Disable debug output.
*
@@ -194,8 +232,8 @@ function setup(env) {
*/
function disable() {
const namespaces = [
...createDebug.names.map(toNamespace),
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
...createDebug.names,
...createDebug.skips.map(namespace => '-' + namespace)
].join(',');
createDebug.enable('');
return namespaces;
@@ -209,21 +247,14 @@ function setup(env) {
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
let i;
let len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
for (const skip of createDebug.skips) {
if (matchesTemplate(name, skip)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
for (const ns of createDebug.names) {
if (matchesTemplate(name, ns)) {
return true;
}
}
@@ -231,19 +262,6 @@ function setup(env) {
return false;
}
/**
* Convert regexp to namespace
*
* @param {RegExp} regxep
* @return {String} namespace
* @api private
*/
function toNamespace(regexp) {
return regexp.toString()
.substring(2, regexp.toString().length - 2)
.replace(/\.\*\?$/, '*');
}
/**
* Coerce `val`.
*

View File

@@ -187,11 +187,11 @@ function getDate() {
}
/**
* Invokes `util.format()` with the specified arguments and writes to stderr.
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
*/
function log(...args) {
return process.stderr.write(util.format(...args) + '\n');
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
}
/**

View File

@@ -23,5 +23,8 @@
"devDependencies": {
"fake": "0.2.0",
"far": "0.0.1"
}
},
"__npminstall_done": true,
"_from": "delayed-stream@1.0.0",
"_resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz"
}

View File

@@ -1,8 +1,9 @@
{
"name": "devalue",
"description": "Gets the job done when JSON.stringify can't",
"version": "4.3.2",
"version": "5.1.1",
"repository": "Rich-Harris/devalue",
"sideEffects": false,
"exports": {
".": {
"types": "./types/index.d.ts",
@@ -25,9 +26,12 @@
"scripts": {
"build": "dts-buddy",
"test": "uvu test",
"prepublishOnly": "npm test && publint && npm run build"
"prepublishOnly": "npm test && npm run build && publint"
},
"license": "MIT",
"type": "module",
"packageManager": "pnpm@8.5.1"
"packageManager": "pnpm@8.5.1",
"__npminstall_done": true,
"_from": "devalue@5.1.1",
"_resolved": "https://registry.npmmirror.com/devalue/-/devalue-5.1.1.tgz"
}

110
.output/server/node_modules/devalue/src/base64.js generated vendored Normal file
View File

@@ -0,0 +1,110 @@
/**
* Base64 Encodes an arraybuffer
* @param {ArrayBuffer} arraybuffer
* @returns {string}
*/
export function encode64(arraybuffer) {
const dv = new DataView(arraybuffer);
let binaryString = "";
for (let i = 0; i < arraybuffer.byteLength; i++) {
binaryString += String.fromCharCode(dv.getUint8(i));
}
return binaryToAscii(binaryString);
}
/**
* Decodes a base64 string into an arraybuffer
* @param {string} string
* @returns {ArrayBuffer}
*/
export function decode64(string) {
const binaryString = asciiToBinary(string);
const arraybuffer = new ArrayBuffer(binaryString.length);
const dv = new DataView(arraybuffer);
for (let i = 0; i < arraybuffer.byteLength; i++) {
dv.setUint8(i, binaryString.charCodeAt(i));
}
return arraybuffer;
}
const KEY_STRING =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
* Substitute for atob since it's deprecated in node.
* Does not do any input validation.
*
* @see https://github.com/jsdom/abab/blob/master/lib/atob.js
*
* @param {string} data
* @returns {string}
*/
function asciiToBinary(data) {
if (data.length % 4 === 0) {
data = data.replace(/==?$/, "");
}
let output = "";
let buffer = 0;
let accumulatedBits = 0;
for (let i = 0; i < data.length; i++) {
buffer <<= 6;
buffer |= KEY_STRING.indexOf(data[i]);
accumulatedBits += 6;
if (accumulatedBits === 24) {
output += String.fromCharCode((buffer & 0xff0000) >> 16);
output += String.fromCharCode((buffer & 0xff00) >> 8);
output += String.fromCharCode(buffer & 0xff);
buffer = accumulatedBits = 0;
}
}
if (accumulatedBits === 12) {
buffer >>= 4;
output += String.fromCharCode(buffer);
} else if (accumulatedBits === 18) {
buffer >>= 2;
output += String.fromCharCode((buffer & 0xff00) >> 8);
output += String.fromCharCode(buffer & 0xff);
}
return output;
}
/**
* Substitute for btoa since it's deprecated in node.
* Does not do any input validation.
*
* @see https://github.com/jsdom/abab/blob/master/lib/btoa.js
*
* @param {string} str
* @returns {string}
*/
function binaryToAscii(str) {
let out = "";
for (let i = 0; i < str.length; i += 3) {
/** @type {[number, number, number, number]} */
const groupsOfSix = [undefined, undefined, undefined, undefined];
groupsOfSix[0] = str.charCodeAt(i) >> 2;
groupsOfSix[1] = (str.charCodeAt(i) & 0x03) << 4;
if (str.length > i + 1) {
groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;
groupsOfSix[2] = (str.charCodeAt(i + 1) & 0x0f) << 2;
}
if (str.length > i + 2) {
groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;
groupsOfSix[3] = str.charCodeAt(i + 2) & 0x3f;
}
for (let j = 0; j < groupsOfSix.length; j++) {
if (typeof groupsOfSix[j] === "undefined") {
out += "=";
} else {
out += KEY_STRING[groupsOfSix[j]];
}
}
}
return out;
}

View File

@@ -1,3 +1,4 @@
import { decode64 } from './base64.js';
import {
HOLE,
NAN,
@@ -101,6 +102,32 @@ export function unflatten(parsed, revivers) {
}
break;
case "Int8Array":
case "Uint8Array":
case "Uint8ClampedArray":
case "Int16Array":
case "Uint16Array":
case "Int32Array":
case "Uint32Array":
case "Float32Array":
case "Float64Array":
case "BigInt64Array":
case "BigUint64Array": {
const TypedArrayConstructor = globalThis[type];
const base64 = value[1];
const arraybuffer = decode64(base64);
const typedArray = new TypedArrayConstructor(arraybuffer);
hydrated[index] = typedArray;
break;
}
case "ArrayBuffer": {
const base64 = value[1];
const arraybuffer = decode64(base64);
hydrated[index] = arraybuffer;
break;
}
default:
throw new Error(`Unknown type ${type}`);
}

View File

@@ -1,8 +1,10 @@
import {
DevalueError,
enumerable_symbols,
get_type,
is_plain_object,
is_primitive,
stringify_key,
stringify_string
} from './utils.js';
import {
@@ -13,6 +15,7 @@ import {
POSITIVE_INFINITY,
UNDEFINED
} from './constants.js';
import { encode64 } from './base64.js';
/**
* Turn a value into a JSON string that can be parsed with `devalue.parse`
@@ -28,8 +31,10 @@ export function stringify(value, reducers) {
/** @type {Array<{ key: string, fn: (value: any) => any }>} */
const custom = [];
for (const key in reducers) {
custom.push({ key, fn: reducers[key] });
if (reducers) {
for (const key of Object.getOwnPropertyNames(reducers)) {
custom.push({ key, fn: reducers[key] });
}
}
/** @type {string[]} */
@@ -81,7 +86,8 @@ export function stringify(value, reducers) {
break;
case 'Date':
str = `["Date","${thing.toISOString()}"]`;
const valid = !isNaN(thing.getDate());
str = `["Date","${valid ? thing.toISOString() : ''}"]`;
break;
case 'RegExp':
@@ -128,11 +134,39 @@ export function stringify(value, reducers) {
`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`
);
str += `,${flatten(key)},${flatten(value)}`;
keys.pop();
}
str += ']';
break;
case "Int8Array":
case "Uint8Array":
case "Uint8ClampedArray":
case "Int16Array":
case "Uint16Array":
case "Int32Array":
case "Uint32Array":
case "Float32Array":
case "Float64Array":
case "BigInt64Array":
case "BigUint64Array": {
/** @type {import("./types.js").TypedArray} */
const typedArray = thing;
const base64 = encode64(typedArray.buffer);
str = '["' + type + '","' + base64 + '"]';
break;
}
case "ArrayBuffer": {
/** @type {ArrayBuffer} */
const arraybuffer = thing;
const base64 = encode64(arraybuffer);
str = `["ArrayBuffer","${base64}"]`;
break;
}
default:
if (!is_plain_object(thing)) {
throw new DevalueError(
@@ -141,7 +175,7 @@ export function stringify(value, reducers) {
);
}
if (Object.getOwnPropertySymbols(thing).length > 0) {
if (enumerable_symbols(thing).length > 0) {
throw new DevalueError(
`Cannot stringify POJOs with symbolic keys`,
keys
@@ -151,7 +185,7 @@ export function stringify(value, reducers) {
if (Object.getPrototypeOf(thing) === null) {
str = '["null"';
for (const key in thing) {
keys.push(`.${key}`);
keys.push(stringify_key(key));
str += `,${stringify_string(key)},${flatten(thing[key])}`;
keys.pop();
}
@@ -162,7 +196,7 @@ export function stringify(value, reducers) {
for (const key in thing) {
if (started) str += ',';
started = true;
keys.push(`.${key}`);
keys.push(stringify_key(key));
str += `${stringify_string(key)}:${flatten(thing[key])}`;
keys.pop();
}

View File

@@ -1,9 +1,11 @@
import {
DevalueError,
enumerable_symbols,
escaped,
get_type,
is_plain_object,
is_primitive,
stringify_key,
stringify_string
} from './utils.js';
@@ -80,6 +82,22 @@ export function uneval(value, replacer) {
keys.pop();
}
break;
case "Int8Array":
case "Uint8Array":
case "Uint8ClampedArray":
case "Int16Array":
case "Uint16Array":
case "Int32Array":
case "Uint32Array":
case "Float32Array":
case "Float64Array":
case "BigInt64Array":
case "BigUint64Array":
return;
case "ArrayBuffer":
return;
default:
if (!is_plain_object(thing)) {
@@ -89,7 +107,7 @@ export function uneval(value, replacer) {
);
}
if (Object.getOwnPropertySymbols(thing).length > 0) {
if (enumerable_symbols(thing).length > 0) {
throw new DevalueError(
`Cannot stringify POJOs with symbolic keys`,
keys
@@ -97,7 +115,7 @@ export function uneval(value, replacer) {
}
for (const key in thing) {
keys.push(`.${key}`);
keys.push(stringify_key(key));
walk(thing[key]);
keys.pop();
}
@@ -159,6 +177,27 @@ export function uneval(value, replacer) {
case 'Set':
case 'Map':
return `new ${type}([${Array.from(thing).map(stringify).join(',')}])`;
case "Int8Array":
case "Uint8Array":
case "Uint8ClampedArray":
case "Int16Array":
case "Uint16Array":
case "Int32Array":
case "Uint32Array":
case "Float32Array":
case "Float64Array":
case "BigInt64Array":
case "BigUint64Array": {
/** @type {import("./types.js").TypedArray} */
const typedArray = thing;
return `new ${type}([${typedArray.toString()}])`;
}
case "ArrayBuffer": {
const ui8 = new Uint8Array(thing);
return `new Uint8Array([${ui8.toString()}]).buffer`;
}
default:
const obj = `{${Object.keys(thing)

View File

@@ -97,3 +97,17 @@ export function stringify_string(str) {
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
}
/** @param {Record<string | symbol, any>} object */
export function enumerable_symbols(object) {
return Object.getOwnPropertySymbols(object).filter(
(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
);
}
const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
/** @param {string} key */
export function stringify_key(key) {
return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';
}

30
.output/server/node_modules/dunder-proto/get.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict';
var callBind = require('call-bind-apply-helpers');
var gOPD = require('gopd');
var hasProtoAccessor;
try {
// eslint-disable-next-line no-extra-parens, no-proto
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
} catch (e) {
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
throw e;
}
}
// eslint-disable-next-line no-extra-parens
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
var $Object = Object;
var $getPrototypeOf = $Object.getPrototypeOf;
/** @type {import('./get')} */
module.exports = desc && typeof desc.get === 'function'
? callBind([desc.get])
: typeof $getPrototypeOf === 'function'
? /** @type {import('./get')} */ function getDunder(value) {
// eslint-disable-next-line eqeqeq
return $getPrototypeOf(value == null ? value : $Object(value));
}
: false;

79
.output/server/node_modules/dunder-proto/package.json generated vendored Normal file
View File

@@ -0,0 +1,79 @@
{
"name": "dunder-proto",
"version": "1.0.1",
"description": "If available, the `Object.prototype.__proto__` accessor and mutator, call-bound",
"main": false,
"exports": {
"./get": "./get.js",
"./set": "./set.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint --ext=.js,.mjs .",
"postlint": "tsc -p . && attw -P",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/es-shims/dunder-proto.git"
},
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/dunder-proto/issues"
},
"homepage": "https://github.com/es-shims/dunder-proto#readme",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.1",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.2",
"@types/tape": "^5.7.0",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"testling": {
"files": "test/index.js"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
},
"__npminstall_done": true,
"_from": "dunder-proto@1.0.1",
"_resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz"
}

536
.output/server/node_modules/entities/lib/decode.js generated vendored Normal file
View File

@@ -0,0 +1,536 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeXML = exports.decodeHTMLStrict = exports.decodeHTMLAttribute = exports.decodeHTML = exports.determineBranch = exports.EntityDecoder = exports.DecodingMode = exports.BinTrieFlags = exports.fromCodePoint = exports.replaceCodePoint = exports.decodeCodePoint = exports.xmlDecodeTree = exports.htmlDecodeTree = void 0;
var decode_data_html_js_1 = __importDefault(require("./generated/decode-data-html.js"));
exports.htmlDecodeTree = decode_data_html_js_1.default;
var decode_data_xml_js_1 = __importDefault(require("./generated/decode-data-xml.js"));
exports.xmlDecodeTree = decode_data_xml_js_1.default;
var decode_codepoint_js_1 = __importStar(require("./decode_codepoint.js"));
exports.decodeCodePoint = decode_codepoint_js_1.default;
var decode_codepoint_js_2 = require("./decode_codepoint.js");
Object.defineProperty(exports, "replaceCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.replaceCodePoint; } });
Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.fromCodePoint; } });
var CharCodes;
(function (CharCodes) {
CharCodes[CharCodes["NUM"] = 35] = "NUM";
CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
CharCodes[CharCodes["NINE"] = 57] = "NINE";
CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
})(CharCodes || (CharCodes = {}));
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
var TO_LOWER_BIT = 32;
var BinTrieFlags;
(function (BinTrieFlags) {
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
})(BinTrieFlags = exports.BinTrieFlags || (exports.BinTrieFlags = {}));
function isNumber(code) {
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
}
function isHexadecimalCharacter(code) {
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
}
function isAsciiAlphaNumeric(code) {
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
isNumber(code));
}
/**
* Checks if the given character is a valid end character for an entity in an attribute.
*
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
*/
function isEntityInAttributeInvalidEnd(code) {
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
}
var EntityDecoderState;
(function (EntityDecoderState) {
EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
})(EntityDecoderState || (EntityDecoderState = {}));
var DecodingMode;
(function (DecodingMode) {
/** Entities in text nodes that can end with any character. */
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
/** Only allow entities terminated with a semicolon. */
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
/** Entities in attributes have limitations on ending characters. */
DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
})(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {}));
/**
* Token decoder with support of writing partial entities.
*/
var EntityDecoder = /** @class */ (function () {
function EntityDecoder(
/** The tree used to decode entities. */
decodeTree,
/**
* The function that is called when a codepoint is decoded.
*
* For multi-byte named entities, this will be called multiple times,
* with the second codepoint, and the same `consumed` value.
*
* @param codepoint The decoded codepoint.
* @param consumed The number of bytes consumed by the decoder.
*/
emitCodePoint,
/** An object that is used to produce errors. */
errors) {
this.decodeTree = decodeTree;
this.emitCodePoint = emitCodePoint;
this.errors = errors;
/** The current state of the decoder. */
this.state = EntityDecoderState.EntityStart;
/** Characters that were consumed while parsing an entity. */
this.consumed = 1;
/**
* The result of the entity.
*
* Either the result index of a numeric entity, or the codepoint of a
* numeric entity.
*/
this.result = 0;
/** The current index in the decode tree. */
this.treeIndex = 0;
/** The number of characters that were consumed in excess. */
this.excess = 1;
/** The mode in which the decoder is operating. */
this.decodeMode = DecodingMode.Strict;
}
/** Resets the instance to make it reusable. */
EntityDecoder.prototype.startEntity = function (decodeMode) {
this.decodeMode = decodeMode;
this.state = EntityDecoderState.EntityStart;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.consumed = 1;
};
/**
* Write an entity to the decoder. This can be called multiple times with partial entities.
* If the entity is incomplete, the decoder will return -1.
*
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
* entity is incomplete, and resume when the next string is written.
*
* @param string The string containing the entity (or a continuation of the entity).
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
EntityDecoder.prototype.write = function (str, offset) {
switch (this.state) {
case EntityDecoderState.EntityStart: {
if (str.charCodeAt(offset) === CharCodes.NUM) {
this.state = EntityDecoderState.NumericStart;
this.consumed += 1;
return this.stateNumericStart(str, offset + 1);
}
this.state = EntityDecoderState.NamedEntity;
return this.stateNamedEntity(str, offset);
}
case EntityDecoderState.NumericStart: {
return this.stateNumericStart(str, offset);
}
case EntityDecoderState.NumericDecimal: {
return this.stateNumericDecimal(str, offset);
}
case EntityDecoderState.NumericHex: {
return this.stateNumericHex(str, offset);
}
case EntityDecoderState.NamedEntity: {
return this.stateNamedEntity(str, offset);
}
}
};
/**
* Switches between the numeric decimal and hexadecimal states.
*
* Equivalent to the `Numeric character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
EntityDecoder.prototype.stateNumericStart = function (str, offset) {
if (offset >= str.length) {
return -1;
}
if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
this.state = EntityDecoderState.NumericHex;
this.consumed += 1;
return this.stateNumericHex(str, offset + 1);
}
this.state = EntityDecoderState.NumericDecimal;
return this.stateNumericDecimal(str, offset);
};
EntityDecoder.prototype.addToNumericResult = function (str, start, end, base) {
if (start !== end) {
var digitCount = end - start;
this.result =
this.result * Math.pow(base, digitCount) +
parseInt(str.substr(start, digitCount), base);
this.consumed += digitCount;
}
};
/**
* Parses a hexadecimal numeric entity.
*
* Equivalent to the `Hexademical character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
EntityDecoder.prototype.stateNumericHex = function (str, offset) {
var startIdx = offset;
while (offset < str.length) {
var char = str.charCodeAt(offset);
if (isNumber(char) || isHexadecimalCharacter(char)) {
offset += 1;
}
else {
this.addToNumericResult(str, startIdx, offset, 16);
return this.emitNumericEntity(char, 3);
}
}
this.addToNumericResult(str, startIdx, offset, 16);
return -1;
};
/**
* Parses a decimal numeric entity.
*
* Equivalent to the `Decimal character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
EntityDecoder.prototype.stateNumericDecimal = function (str, offset) {
var startIdx = offset;
while (offset < str.length) {
var char = str.charCodeAt(offset);
if (isNumber(char)) {
offset += 1;
}
else {
this.addToNumericResult(str, startIdx, offset, 10);
return this.emitNumericEntity(char, 2);
}
}
this.addToNumericResult(str, startIdx, offset, 10);
return -1;
};
/**
* Validate and emit a numeric entity.
*
* Implements the logic from the `Hexademical character reference start
* state` and `Numeric character reference end state` in the HTML spec.
*
* @param lastCp The last code point of the entity. Used to see if the
* entity was terminated with a semicolon.
* @param expectedLength The minimum number of characters that should be
* consumed. Used to validate that at least one digit
* was consumed.
* @returns The number of characters that were consumed.
*/
EntityDecoder.prototype.emitNumericEntity = function (lastCp, expectedLength) {
var _a;
// Ensure we consumed at least one digit.
if (this.consumed <= expectedLength) {
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
// Figure out if this is a legit end of the entity
if (lastCp === CharCodes.SEMI) {
this.consumed += 1;
}
else if (this.decodeMode === DecodingMode.Strict) {
return 0;
}
this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed);
if (this.errors) {
if (lastCp !== CharCodes.SEMI) {
this.errors.missingSemicolonAfterCharacterReference();
}
this.errors.validateNumericCharacterReference(this.result);
}
return this.consumed;
};
/**
* Parses a named entity.
*
* Equivalent to the `Named character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
EntityDecoder.prototype.stateNamedEntity = function (str, offset) {
var decodeTree = this.decodeTree;
var current = decodeTree[this.treeIndex];
// The mask is the number of bytes of the value, including the current byte.
var valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
for (; offset < str.length; offset++, this.excess++) {
var char = str.charCodeAt(offset);
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
if (this.treeIndex < 0) {
return this.result === 0 ||
// If we are parsing an attribute
(this.decodeMode === DecodingMode.Attribute &&
// We shouldn't have consumed any characters after the entity,
(valueLength === 0 ||
// And there should be no invalid characters.
isEntityInAttributeInvalidEnd(char)))
? 0
: this.emitNotTerminatedNamedEntity();
}
current = decodeTree[this.treeIndex];
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
// If the branch is a value, store it and continue
if (valueLength !== 0) {
// If the entity is terminated by a semicolon, we are done.
if (char === CharCodes.SEMI) {
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
}
// If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
if (this.decodeMode !== DecodingMode.Strict) {
this.result = this.treeIndex;
this.consumed += this.excess;
this.excess = 0;
}
}
}
return -1;
};
/**
* Emit a named entity that was not terminated with a semicolon.
*
* @returns The number of characters consumed.
*/
EntityDecoder.prototype.emitNotTerminatedNamedEntity = function () {
var _a;
var _b = this, result = _b.result, decodeTree = _b.decodeTree;
var valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
this.emitNamedEntityData(result, valueLength, this.consumed);
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
return this.consumed;
};
/**
* Emit a named entity.
*
* @param result The index of the entity in the decode tree.
* @param valueLength The number of bytes in the entity.
* @param consumed The number of characters consumed.
*
* @returns The number of characters consumed.
*/
EntityDecoder.prototype.emitNamedEntityData = function (result, valueLength, consumed) {
var decodeTree = this.decodeTree;
this.emitCodePoint(valueLength === 1
? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
: decodeTree[result + 1], consumed);
if (valueLength === 3) {
// For multi-byte values, we need to emit the second byte.
this.emitCodePoint(decodeTree[result + 2], consumed);
}
return consumed;
};
/**
* Signal to the parser that the end of the input was reached.
*
* Remaining data will be emitted and relevant errors will be produced.
*
* @returns The number of characters consumed.
*/
EntityDecoder.prototype.end = function () {
var _a;
switch (this.state) {
case EntityDecoderState.NamedEntity: {
// Emit a named entity if we have one.
return this.result !== 0 &&
(this.decodeMode !== DecodingMode.Attribute ||
this.result === this.treeIndex)
? this.emitNotTerminatedNamedEntity()
: 0;
}
// Otherwise, emit a numeric entity if we have one.
case EntityDecoderState.NumericDecimal: {
return this.emitNumericEntity(0, 2);
}
case EntityDecoderState.NumericHex: {
return this.emitNumericEntity(0, 3);
}
case EntityDecoderState.NumericStart: {
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
case EntityDecoderState.EntityStart: {
// Return 0 if we have no entity.
return 0;
}
}
};
return EntityDecoder;
}());
exports.EntityDecoder = EntityDecoder;
/**
* Creates a function that decodes entities in a string.
*
* @param decodeTree The decode tree.
* @returns A function that decodes entities in a string.
*/
function getDecoder(decodeTree) {
var ret = "";
var decoder = new EntityDecoder(decodeTree, function (str) { return (ret += (0, decode_codepoint_js_1.fromCodePoint)(str)); });
return function decodeWithTrie(str, decodeMode) {
var lastIndex = 0;
var offset = 0;
while ((offset = str.indexOf("&", offset)) >= 0) {
ret += str.slice(lastIndex, offset);
decoder.startEntity(decodeMode);
var len = decoder.write(str,
// Skip the "&"
offset + 1);
if (len < 0) {
lastIndex = offset + decoder.end();
break;
}
lastIndex = offset + len;
// If `len` is 0, skip the current `&` and continue.
offset = len === 0 ? lastIndex + 1 : lastIndex;
}
var result = ret + str.slice(lastIndex);
// Make sure we don't keep a reference to the final string.
ret = "";
return result;
};
}
/**
* Determines the branch of the current node that is taken given the current
* character. This function is used to traverse the trie.
*
* @param decodeTree The trie.
* @param current The current node.
* @param nodeIdx The index right after the current node and its value.
* @param char The current character.
* @returns The index of the next node, or -1 if no branch is taken.
*/
function determineBranch(decodeTree, current, nodeIdx, char) {
var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
var jumpOffset = current & BinTrieFlags.JUMP_TABLE;
// Case 1: Single branch encoded in jump offset
if (branchCount === 0) {
return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
}
// Case 2: Multiple branches encoded in jump table
if (jumpOffset) {
var value = char - jumpOffset;
return value < 0 || value >= branchCount
? -1
: decodeTree[nodeIdx + value] - 1;
}
// Case 3: Multiple branches encoded in dictionary
// Binary search for the character.
var lo = nodeIdx;
var hi = lo + branchCount - 1;
while (lo <= hi) {
var mid = (lo + hi) >>> 1;
var midVal = decodeTree[mid];
if (midVal < char) {
lo = mid + 1;
}
else if (midVal > char) {
hi = mid - 1;
}
else {
return decodeTree[mid + branchCount];
}
}
return -1;
}
exports.determineBranch = determineBranch;
var htmlDecoder = getDecoder(decode_data_html_js_1.default);
var xmlDecoder = getDecoder(decode_data_xml_js_1.default);
/**
* Decodes an HTML string.
*
* @param str The string to decode.
* @param mode The decoding mode.
* @returns The decoded string.
*/
function decodeHTML(str, mode) {
if (mode === void 0) { mode = DecodingMode.Legacy; }
return htmlDecoder(str, mode);
}
exports.decodeHTML = decodeHTML;
/**
* Decodes an HTML string in an attribute.
*
* @param str The string to decode.
* @returns The decoded string.
*/
function decodeHTMLAttribute(str) {
return htmlDecoder(str, DecodingMode.Attribute);
}
exports.decodeHTMLAttribute = decodeHTMLAttribute;
/**
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
*
* @param str The string to decode.
* @returns The decoded string.
*/
function decodeHTMLStrict(str) {
return htmlDecoder(str, DecodingMode.Strict);
}
exports.decodeHTMLStrict = decodeHTMLStrict;
/**
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
*
* @param str The string to decode.
* @returns The decoded string.
*/
function decodeXML(str) {
return xmlDecoder(str, DecodingMode.Strict);
}
exports.decodeXML = decodeXML;
//# sourceMappingURL=decode.js.map

View File

@@ -0,0 +1,76 @@
"use strict";
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceCodePoint = exports.fromCodePoint = void 0;
var decodeMap = new Map([
[0, 65533],
// C1 Unicode control character reference replacements
[128, 8364],
[130, 8218],
[131, 402],
[132, 8222],
[133, 8230],
[134, 8224],
[135, 8225],
[136, 710],
[137, 8240],
[138, 352],
[139, 8249],
[140, 338],
[142, 381],
[145, 8216],
[146, 8217],
[147, 8220],
[148, 8221],
[149, 8226],
[150, 8211],
[151, 8212],
[152, 732],
[153, 8482],
[154, 353],
[155, 8250],
[156, 339],
[158, 382],
[159, 376],
]);
/**
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
*/
exports.fromCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
var output = "";
if (codePoint > 0xffff) {
codePoint -= 0x10000;
output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
codePoint = 0xdc00 | (codePoint & 0x3ff);
}
output += String.fromCharCode(codePoint);
return output;
};
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
*/
function replaceCodePoint(codePoint) {
var _a;
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
return 0xfffd;
}
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
}
exports.replaceCodePoint = replaceCodePoint;
/**
* Replace the code point if relevant, then convert it to a string.
*
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
* @param codePoint The code point to decode.
* @returns The decoded code point.
*/
function decodeCodePoint(codePoint) {
return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
}
exports.default = decodeCodePoint;
//# sourceMappingURL=decode_codepoint.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
"use strict";
// Generated using scripts/write-decode-map.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = new Uint16Array(
// prettier-ignore
"\u0200aglq\t\x15\x18\x1b\u026d\x0f\0\0\x12p;\u4026os;\u4027t;\u403et;\u403cuot;\u4022"
.split("")
.map(function (c) { return c.charCodeAt(0); }));
//# sourceMappingURL=decode-data-xml.js.map

93
.output/server/node_modules/entities/package.json generated vendored Normal file
View File

@@ -0,0 +1,93 @@
{
"name": "entities",
"version": "4.5.0",
"description": "Encode & decode XML and HTML entities with ease & speed",
"author": "Felix Boehm <me@feedic.com>",
"funding": "https://github.com/fb55/entities?sponsor=1",
"sideEffects": false,
"keywords": [
"entity",
"decoding",
"encoding",
"html",
"xml",
"html entities"
],
"directories": {
"lib": "lib/"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/esm/index.js",
"exports": {
".": {
"require": "./lib/index.js",
"import": "./lib/esm/index.js"
},
"./lib/decode.js": {
"require": "./lib/decode.js",
"import": "./lib/esm/decode.js"
},
"./lib/escape.js": {
"require": "./lib/escape.js",
"import": "./lib/esm/escape.js"
}
},
"files": [
"lib/**/*"
],
"engines": {
"node": ">=0.12"
},
"devDependencies": {
"@types/jest": "^28.1.8",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^28.1.3",
"prettier": "^2.8.7",
"ts-jest": "^28.0.8",
"typedoc": "^0.24.1",
"typescript": "^5.0.4"
},
"scripts": {
"test": "npm run test:jest && npm run lint",
"test:jest": "jest",
"lint": "npm run lint:es && npm run lint:prettier",
"lint:es": "eslint .",
"lint:prettier": "npm run prettier -- --check",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
"prettier": "prettier '**/*.{ts,md,json,yml}'",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/entities/$(git rev-parse HEAD)/src/",
"build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"build:docs": "typedoc --hideGenerator src/index.ts",
"build:trie": "ts-node scripts/write-decode-map.ts",
"build:encode-trie": "ts-node scripts/write-encode-map.ts",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/fb55/entities.git"
},
"license": "BSD-2-Clause",
"jest": {
"preset": "ts-jest",
"coverageProvider": "v8",
"moduleNameMapper": {
"^(.*)\\.js$": "$1"
}
},
"prettier": {
"tabWidth": 4,
"proseWrap": "always"
},
"__npminstall_done": true,
"_from": "entities@4.5.0",
"_resolved": "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz"
}

View File

@@ -0,0 +1,14 @@
'use strict';
/** @type {import('.')} */
var $defineProperty = Object.defineProperty || false;
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = false;
}
}
module.exports = $defineProperty;

View File

@@ -0,0 +1,84 @@
{
"name": "es-define-property",
"version": "1.0.1",
"description": "`Object.defineProperty`, but not IE 8's broken one.",
"main": "index.js",
"types": "./index.d.ts",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -p .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/es-define-property.git"
},
"keywords": [
"javascript",
"ecmascript",
"object",
"define",
"property",
"defineProperty",
"Object.defineProperty"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/es-define-property/issues"
},
"homepage": "https://github.com/ljharb/es-define-property#readme",
"devDependencies": {
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.2",
"@types/gopd": "^1.0.3",
"@types/tape": "^5.6.5",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "^8.8.0",
"evalmd": "^0.0.19",
"gopd": "^1.2.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"testling": {
"files": "test/index.js"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"__npminstall_done": true,
"_from": "es-define-property@1.0.1",
"_resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz"
}

4
.output/server/node_modules/es-errors/eval.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./eval')} */
module.exports = EvalError;

4
.output/server/node_modules/es-errors/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('.')} */
module.exports = Error;

83
.output/server/node_modules/es-errors/package.json generated vendored Normal file
View File

@@ -0,0 +1,83 @@
{
"name": "es-errors",
"version": "1.3.0",
"description": "A simple cache for a few of the JS Error constructors.",
"main": "index.js",
"exports": {
".": "./index.js",
"./eval": "./eval.js",
"./range": "./range.js",
"./ref": "./ref.js",
"./syntax": "./syntax.js",
"./type": "./type.js",
"./uri": "./uri.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "nyc tape 'test/**/*.js'",
"posttest": "aud --production",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/es-errors.git"
},
"keywords": [
"javascript",
"ecmascript",
"error",
"typeerror",
"syntaxerror",
"rangeerror"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/es-errors/issues"
},
"homepage": "https://github.com/ljharb/es-errors#readme",
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eclint": "^2.8.1",
"eslint": "^8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.4",
"typescript": "next"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
},
"__npminstall_done": true,
"_from": "es-errors@1.3.0",
"_resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz"
}

4
.output/server/node_modules/es-errors/range.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./range')} */
module.exports = RangeError;

4
.output/server/node_modules/es-errors/ref.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./ref')} */
module.exports = ReferenceError;

4
.output/server/node_modules/es-errors/syntax.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./syntax')} */
module.exports = SyntaxError;

Some files were not shown because too many files have changed in this diff Show More