feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

14582
.output/server/node_modules/@babel/parser/lib/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

50
.output/server/node_modules/@babel/parser/package.json generated vendored Normal file
View File

@@ -0,0 +1,50 @@
{
"name": "@babel/parser",
"version": "7.29.0",
"description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A+parser+%28babylon%29%22+is%3Aopen",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel",
"javascript",
"parser",
"tc39",
"ecmascript",
"@babel/parser"
],
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-parser"
},
"main": "./lib/index.js",
"types": "./typings/babel-parser.d.ts",
"files": [
"bin",
"lib",
"typings/babel-parser.d.ts",
"index.cjs"
],
"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.29.0"
},
"devDependencies": {
"@babel/code-frame": "^7.29.0",
"@babel/helper-check-duplicate-nodes": "^7.28.6",
"@babel/helper-fixtures": "^7.28.6",
"@babel/helper-string-parser": "^7.27.1",
"@babel/helper-validator-identifier": "^7.28.5",
"charcodes": "^0.2.0"
},
"bin": "./bin/babel-parser.js",
"type": "commonjs"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
{
"name": "@vue/compiler-core",
"version": "3.5.28",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
"types": "dist/compiler-core.d.ts",
"files": [
"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,
"formats": [
"esm-bundler",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-core"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.29.0",
"entities": "^7.0.1",
"estree-walker": "^2.0.2",
"source-map-js": "^1.2.1",
"@vue/shared": "3.5.28"
},
"devDependencies": {
"@babel/types": "^7.29.0"
}
}

View File

@@ -0,0 +1,689 @@
/**
* @vue/compiler-dom v3.5.28
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var compilerCore = require('@vue/compiler-core');
var shared = require('@vue/shared');
const V_MODEL_RADIO = /* @__PURE__ */ Symbol(``);
const V_MODEL_CHECKBOX = /* @__PURE__ */ Symbol(
``
);
const V_MODEL_TEXT = /* @__PURE__ */ Symbol(``);
const V_MODEL_SELECT = /* @__PURE__ */ Symbol(
``
);
const V_MODEL_DYNAMIC = /* @__PURE__ */ Symbol(
``
);
const V_ON_WITH_MODIFIERS = /* @__PURE__ */ Symbol(
``
);
const V_ON_WITH_KEYS = /* @__PURE__ */ Symbol(
``
);
const V_SHOW = /* @__PURE__ */ Symbol(``);
const TRANSITION = /* @__PURE__ */ Symbol(``);
const TRANSITION_GROUP = /* @__PURE__ */ Symbol(
``
);
compilerCore.registerRuntimeHelpers({
[V_MODEL_RADIO]: `vModelRadio`,
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
[V_MODEL_TEXT]: `vModelText`,
[V_MODEL_SELECT]: `vModelSelect`,
[V_MODEL_DYNAMIC]: `vModelDynamic`,
[V_ON_WITH_MODIFIERS]: `withModifiers`,
[V_ON_WITH_KEYS]: `withKeys`,
[V_SHOW]: `vShow`,
[TRANSITION]: `Transition`,
[TRANSITION_GROUP]: `TransitionGroup`
});
const parserOptions = {
parseMode: "html",
isVoidTag: shared.isVoidTag,
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") {
return TRANSITION;
} else if (tag === "TransitionGroup" || tag === "transition-group") {
return TRANSITION_GROUP;
}
},
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if (tag === "svg") {
return 1;
}
if (parent.props.some(
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
)) {
ns = 0;
}
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
ns = 0;
}
} else if (parent && ns === 1) {
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
ns = 0;
}
}
if (ns === 0) {
if (tag === "svg") {
return 1;
}
if (tag === "math") {
return 2;
}
}
return ns;
}
};
const transformStyle = (node) => {
if (node.type === 1) {
node.props.forEach((p, i) => {
if (p.type === 6 && p.name === "style" && p.value) {
node.props[i] = {
type: 7,
name: `bind`,
arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
exp: parseInlineCSS(p.value.content, p.loc),
modifiers: [],
loc: p.loc
};
}
});
}
};
const parseInlineCSS = (cssText, loc) => {
const normalized = shared.parseStringStyle(cssText);
return compilerCore.createSimpleExpression(
JSON.stringify(normalized),
false,
loc,
3
);
};
function createDOMCompilerError(code, loc) {
return compilerCore.createCompilerError(
code,
loc,
DOMErrorMessages
);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
};
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) {
context.onError(
createDOMCompilerError(54, loc)
);
}
if (node.children.length) {
context.onError(
createDOMCompilerError(55, loc)
);
node.children.length = 0;
}
return {
props: [
compilerCore.createObjectProperty(
compilerCore.createSimpleExpression(`innerHTML`, true, loc),
exp || compilerCore.createSimpleExpression("", true)
)
]
};
};
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) {
context.onError(
createDOMCompilerError(56, loc)
);
}
if (node.children.length) {
context.onError(
createDOMCompilerError(57, loc)
);
node.children.length = 0;
}
return {
props: [
compilerCore.createObjectProperty(
compilerCore.createSimpleExpression(`textContent`, true),
exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
context.helperString(compilerCore.TO_DISPLAY_STRING),
[exp],
loc
) : compilerCore.createSimpleExpression("", true)
)
]
};
};
const transformModel = (dir, node, context) => {
const baseResult = compilerCore.transformModel(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) {
return baseResult;
}
if (dir.arg) {
context.onError(
createDOMCompilerError(
59,
dir.arg.loc
)
);
}
const { tag } = node;
const isCustomElement = context.isCustomElement(tag);
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
let directiveToUse = V_MODEL_TEXT;
let isInvalidType = false;
if (tag === "input" || isCustomElement) {
const type = compilerCore.findProp(node, `type`);
if (type) {
if (type.type === 7) {
directiveToUse = V_MODEL_DYNAMIC;
} else if (type.value) {
switch (type.value.content) {
case "radio":
directiveToUse = V_MODEL_RADIO;
break;
case "checkbox":
directiveToUse = V_MODEL_CHECKBOX;
break;
case "file":
isInvalidType = true;
context.onError(
createDOMCompilerError(
60,
dir.loc
)
);
break;
}
}
} else if (compilerCore.hasDynamicKeyVBind(node)) {
directiveToUse = V_MODEL_DYNAMIC;
} else ;
} else if (tag === "select") {
directiveToUse = V_MODEL_SELECT;
} else ;
if (!isInvalidType) {
baseResult.needRuntime = context.helper(directiveToUse);
}
} else {
context.onError(
createDOMCompilerError(
58,
dir.loc
)
);
}
baseResult.props = baseResult.props.filter(
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
);
return baseResult;
};
const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
// event propagation management
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
);
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "native" && compilerCore.checkCompatEnabled(
"COMPILER_V_ON_NATIVE",
context,
loc
)) {
eventOptionModifiers.push(modifier);
} else if (isEventOptionModifier(modifier)) {
eventOptionModifiers.push(modifier);
} else {
if (maybeKeyModifier(modifier)) {
if (compilerCore.isStaticExp(key)) {
if (isKeyboardEvent(key.content.toLowerCase())) {
keyModifiers.push(modifier);
} else {
nonKeyModifiers.push(modifier);
}
} else {
keyModifiers.push(modifier);
nonKeyModifiers.push(modifier);
}
} else {
if (isNonKeyModifier(modifier)) {
nonKeyModifiers.push(modifier);
} else {
keyModifiers.push(modifier);
}
}
}
}
return {
keyModifiers,
nonKeyModifiers,
eventOptionModifiers
};
};
const transformClick = (key, event) => {
const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn = (dir, node, context) => {
return compilerCore.transformOn(dir, node, context, (baseResult) => {
const { modifiers } = dir;
if (!modifiers.length) return baseResult;
let { key, value: handlerExp } = baseResult.props[0];
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
if (nonKeyModifiers.includes("right")) {
key = transformClick(key, `onContextmenu`);
}
if (nonKeyModifiers.includes("middle")) {
key = transformClick(key, `onMouseup`);
}
if (nonKeyModifiers.length) {
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
handlerExp,
JSON.stringify(nonKeyModifiers)
]);
}
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
handlerExp,
JSON.stringify(keyModifiers)
]);
}
if (eventOptionModifiers.length) {
const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
}
return {
props: [compilerCore.createObjectProperty(key, handlerExp)]
};
});
};
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) {
context.onError(
createDOMCompilerError(62, loc)
);
}
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) {
return;
}
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
const stringifyCurrentChunk = (currentIndex) => {
if (nc >= 20 || ec >= 5) {
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
JSON.stringify(
currentChunk.map((node) => stringifyNode(node, context)).join("")
).replace(expReplaceRE, `" + $1 + "`),
// the 2nd argument indicates the number of DOM nodes this static vnode
// will insert / hydrate
String(currentChunk.length)
]);
const deleteCount = currentChunk.length - 1;
if (isParentCached) {
children.splice(
currentIndex - currentChunk.length,
currentChunk.length,
// @ts-expect-error
staticCall
);
} else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(
currentChunk[currentChunk.length - 1].codegenNode
);
if (cacheIndex > -1) {
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
const c = context.cached[i2];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
const isCached = isParentCached || getCachedNode(child);
if (isCached) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(child);
continue;
}
}
i -= stringifyCurrentChunk(i);
nc = 0;
ec = 0;
currentChunk.length = 0;
}
stringifyCurrentChunk(i);
};
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
return node.codegenNode;
}
};
const dataAriaRE = /^(?:data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : ns === 2 ? shared.isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
);
function analyzeNode(node) {
if (node.type === 1 && isNonStringifiable(node.tag)) {
return false;
}
if (node.type === 1 && compilerCore.findDir(node, "once", true)) {
return false;
}
if (node.type === 12) {
return [1, 0];
}
let nc = 1;
let ec = node.props.length > 0 ? 1 : 0;
let bailed = false;
const bail = () => {
bailed = true;
return false;
};
function walk(node2) {
const isOptionTag = node2.tag === "option" && node2.ns === 0;
for (let i = 0; i < node2.props.length; i++) {
const p = node2.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
return bail();
}
if (p.type === 7 && p.name === "bind") {
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
return bail();
}
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
return bail();
}
if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
return bail();
}
}
}
for (let i = 0; i < node2.children.length; i++) {
nc++;
const child = node2.children[i];
if (child.type === 1) {
if (child.props.length > 0) {
ec++;
}
walk(child);
if (bailed) {
return false;
}
}
}
return true;
}
return walk(node) ? [nc, ec] : false;
}
function stringifyNode(node, context) {
if (shared.isString(node)) {
return node;
}
if (shared.isSymbol(node)) {
return ``;
}
switch (node.type) {
case 1:
return stringifyElement(node, context);
case 2:
return shared.escapeHtml(node.content);
case 3:
return `<!--${shared.escapeHtml(node.content)}-->`;
case 5:
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
case 8:
return shared.escapeHtml(evaluateConstant(node));
case 12:
return stringifyNode(node.content, context);
default:
return "";
}
}
function stringifyElement(node, context) {
let res = `<${node.tag}`;
let innerHTML = "";
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i];
if (p.type === 6) {
res += ` ${p.name}`;
if (p.value) {
res += `="${shared.escapeHtml(p.value.content)}"`;
}
} else if (p.type === 7) {
if (p.name === "bind") {
const exp = p.exp;
if (exp.content[0] === "_") {
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
continue;
}
if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
continue;
}
let evaluated = evaluateConstant(exp);
if (evaluated != null) {
const arg = p.arg && p.arg.content;
if (arg === "class") {
evaluated = shared.normalizeClass(evaluated);
} else if (arg === "style") {
evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
}
res += ` ${p.arg.content}="${shared.escapeHtml(
evaluated
)}"`;
}
} else if (p.name === "html") {
innerHTML = evaluateConstant(p.exp);
} else if (p.name === "text") {
innerHTML = shared.escapeHtml(
shared.toDisplayString(evaluateConstant(p.exp))
);
}
}
}
if (context.scopeId) {
res += ` ${context.scopeId}`;
}
res += `>`;
if (innerHTML) {
res += innerHTML;
} else {
for (let i = 0; i < node.children.length; i++) {
res += stringifyNode(node.children[i], context);
}
}
if (!shared.isVoidTag(node.tag)) {
res += `</${node.tag}>`;
}
return res;
}
function evaluateConstant(exp) {
if (exp.type === 4) {
return new Function(`return (${exp.content})`)();
} else {
let res = ``;
exp.children.forEach((c) => {
if (shared.isString(c) || shared.isSymbol(c)) {
return;
}
if (c.type === 2) {
res += c.content;
} else if (c.type === 5) {
res += shared.toDisplayString(evaluateConstant(c.content));
} else {
res += evaluateConstant(c);
}
});
return res;
}
}
const ignoreSideEffectTags = (node, context) => {
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
context.removeNode();
}
};
const DOMNodeTransforms = [
transformStyle,
...[]
];
const DOMDirectiveTransforms = {
cloak: compilerCore.noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel,
// override compiler-core
on: transformOn,
// override compiler-core
show: transformShow
};
function compile(src, options = {}) {
return compilerCore.baseCompile(
src,
shared.extend({}, parserOptions, options, {
nodeTransforms: [
// ignore <script> and <tag>
// this is not put inside DOMNodeTransforms because that list is used
// by compiler-ssr to generate vnode fallback branches
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: shared.extend(
{},
DOMDirectiveTransforms,
options.directiveTransforms || {}
),
transformHoist: stringifyStatic
})
);
}
function parse(template, options = {}) {
return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
}
exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
exports.DOMErrorCodes = DOMErrorCodes;
exports.DOMErrorMessages = DOMErrorMessages;
exports.DOMNodeTransforms = DOMNodeTransforms;
exports.TRANSITION = TRANSITION;
exports.TRANSITION_GROUP = TRANSITION_GROUP;
exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
exports.V_MODEL_RADIO = V_MODEL_RADIO;
exports.V_MODEL_SELECT = V_MODEL_SELECT;
exports.V_MODEL_TEXT = V_MODEL_TEXT;
exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
exports.V_SHOW = V_SHOW;
exports.compile = compile;
exports.createDOMCompilerError = createDOMCompilerError;
exports.parse = parse;
exports.parserOptions = parserOptions;
exports.transformStyle = transformStyle;
Object.keys(compilerCore).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
});

View File

@@ -0,0 +1,57 @@
{
"name": "@vue/compiler-dom",
"version": "3.5.28",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
"types": "dist/compiler-dom.d.ts",
"unpkg": "dist/compiler-dom.global.js",
"jsdelivr": "dist/compiler-dom.global.js",
"files": [
"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",
"compat": true,
"formats": [
"esm-bundler",
"esm-browser",
"cjs",
"global"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-dom"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/compiler-core": "3.5.28",
"@vue/shared": "3.5.28"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
{
"name": "@vue/compiler-ssr",
"version": "3.5.28",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
"files": [
"dist"
],
"buildOptions": {
"prod": false,
"formats": [
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-ssr"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.5.28",
"@vue/compiler-dom": "3.5.28"
}
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,22 @@
"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 __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./api.js"), exports);
__exportStar(require("./app.js"), exports);
__exportStar(require("./component.js"), exports);
__exportStar(require("./context.js"), exports);
__exportStar(require("./hooks.js"), exports);
__exportStar(require("./util.js"), exports);

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HOOK_PLUGIN_SETTINGS_SET = exports.HOOK_SETUP = void 0;
exports.HOOK_SETUP = 'devtools-plugin:setup';
exports.HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isProxyAvailable = exports.getTarget = exports.getDevtoolsGlobalHook = void 0;
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
exports.getDevtoolsGlobalHook = getDevtoolsGlobalHook;
function getTarget() {
// @ts-expect-error navigator and windows are not available in all environments
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
? window
: typeof globalThis !== 'undefined'
? globalThis
: {};
}
exports.getTarget = getTarget;
exports.isProxyAvailable = typeof Proxy === 'function';

View File

@@ -0,0 +1,45 @@
"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 __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupDevtoolsPlugin = void 0;
const env_js_1 = require("./env.js");
const const_js_1 = require("./const.js");
const proxy_js_1 = require("./proxy.js");
__exportStar(require("./api/index.js"), exports);
__exportStar(require("./plugin.js"), exports);
__exportStar(require("./time.js"), exports);
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const descriptor = pluginDescriptor;
const target = (0, env_js_1.getTarget)();
const hook = (0, env_js_1.getDevtoolsGlobalHook)();
const enableProxy = env_js_1.isProxyAvailable && descriptor.enableEarlyProxy;
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
hook.emit(const_js_1.HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const proxy = enableProxy ? new proxy_js_1.ApiProxy(descriptor, hook) : null;
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor: descriptor,
setupFn,
proxy,
});
if (proxy) {
setupFn(proxy.proxiedTarget);
}
}
}
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,111 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiProxy = void 0;
const const_js_1 = require("./const.js");
const time_js_1 = require("./time.js");
class ApiProxy {
constructor(plugin, hook) {
this.target = null;
this.targetQueue = [];
this.onQueue = [];
this.plugin = plugin;
this.hook = hook;
const defaultSettings = {};
if (plugin.settings) {
for (const id in plugin.settings) {
const item = plugin.settings[id];
defaultSettings[id] = item.defaultValue;
}
}
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
let currentSettings = Object.assign({}, defaultSettings);
try {
const raw = localStorage.getItem(localSettingsSaveId);
const data = JSON.parse(raw);
Object.assign(currentSettings, data);
}
catch (e) {
// noop
}
this.fallbacks = {
getSettings() {
return currentSettings;
},
setSettings(value) {
try {
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
}
catch (e) {
// noop
}
currentSettings = value;
},
now() {
return (0, time_js_1.now)();
},
};
if (hook) {
hook.on(const_js_1.HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
if (pluginId === this.plugin.id) {
this.fallbacks.setSettings(value);
}
});
}
this.proxiedOn = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target.on[prop];
}
else {
return (...args) => {
this.onQueue.push({
method: prop,
args,
});
};
}
},
});
this.proxiedTarget = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target[prop];
}
else if (prop === 'on') {
return this.proxiedOn;
}
else if (Object.keys(this.fallbacks).includes(prop)) {
return (...args) => {
this.targetQueue.push({
method: prop,
args,
resolve: () => { },
});
return this.fallbacks[prop](...args);
};
}
else {
return (...args) => {
return new Promise((resolve) => {
this.targetQueue.push({
method: prop,
args,
resolve,
});
});
};
}
},
});
}
async setRealTarget(target) {
this.target = target;
for (const item of this.onQueue) {
this.target.on[item.method](...item.args);
}
for (const item of this.targetQueue) {
item.resolve(await this.target[item.method](...item.args));
}
}
}
exports.ApiProxy = ApiProxy;

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.isPerformanceSupported = void 0;
let supported;
let perf;
function isPerformanceSupported() {
var _a;
if (supported !== undefined) {
return supported;
}
if (typeof window !== 'undefined' && window.performance) {
supported = true;
perf = window.performance;
}
else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
supported = true;
perf = globalThis.perf_hooks.performance;
}
else {
supported = false;
}
return supported;
}
exports.isPerformanceSupported = isPerformanceSupported;
function now() {
return isPerformanceSupported() ? perf.now() : Date.now();
}
exports.now = now;

View File

@@ -0,0 +1,37 @@
{
"name": "@vue/devtools-api",
"version": "6.6.4",
"description": "Interact with the Vue devtools from the page",
"author": {
"name": "Guillaume Chau"
},
"license": "MIT",
"repository": {
"url": "https://github.com/vuejs/vue-devtools.git",
"type": "git",
"directory": "packages/api"
},
"sideEffects": false,
"main": "lib/cjs/index.js",
"browser": "lib/esm/index.js",
"module": "lib/esm/index.js",
"types": "lib/esm/index.d.ts",
"files": [
"lib/cjs",
"lib/esm"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "rimraf lib && yarn build:esm && yarn build:cjs",
"build:esm": "tsc --module es2015 --outDir lib/esm -d",
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
"build:watch": "yarn tsc --module es2015 --outDir lib/esm -d -w --sourceMap"
},
"devDependencies": {
"@types/node": "^20.11.16",
"@types/webpack-env": "^1.15.1",
"typescript": "^5.3.3"
}
}

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
{
"name": "@vue/runtime-core",
"version": "3.5.28",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
"types": "dist/runtime-core.d.ts",
"files": [
"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": [
"esm-bundler",
"cjs"
]
},
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/runtime-core"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.5.28",
"@vue/reactivity": "3.5.28"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
{
"name": "@vue/runtime-dom",
"version": "3.5.28",
"description": "@vue/runtime-dom",
"main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js",
"types": "dist/runtime-dom.d.ts",
"unpkg": "dist/runtime-dom.global.js",
"files": [
"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",
"formats": [
"esm-bundler",
"esm-browser",
"cjs",
"global"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/runtime-dom"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"csstype": "^3.2.3",
"@vue/runtime-core": "3.5.28",
"@vue/reactivity": "3.5.28",
"@vue/shared": "3.5.28"
},
"devDependencies": {
"@types/trusted-types": "^2.0.7"
}
}

View File

@@ -0,0 +1,879 @@
/**
* @vue/server-renderer v3.5.28
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var Vue = require('vue');
var shared = require('@vue/shared');
var compilerSsr = require('@vue/compiler-ssr');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
for (var k in e) {
n[k] = e[k];
}
}
n.default = e;
return Object.freeze(n);
}
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
const shouldIgnoreProp = /* @__PURE__ */ shared.makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`
);
function ssrRenderAttrs(props, tag) {
let ret = "";
for (let key in props) {
if (shouldIgnoreProp(key) || shared.isOn(key) || tag === "textarea" && key === "value" || // force as property (not rendered in SSR)
key.startsWith(".")) {
continue;
}
const value = props[key];
if (key.startsWith("^")) key = key.slice(1);
if (key === "class" || key === "className") {
ret += ` class="${ssrRenderClass(value)}"`;
} else if (key === "style") {
ret += ` style="${ssrRenderStyle(value)}"`;
} else {
ret += ssrRenderDynamicAttr(key, value, tag);
}
}
return ret;
}
function ssrRenderDynamicAttr(key, value, tag) {
if (!shared.isRenderableAttrValue(value)) {
return ``;
}
const attrKey = tag && (tag.indexOf("-") > 0 || shared.isSVGTag(tag)) ? key : shared.propsToAttrMap[key] || key.toLowerCase();
if (shared.isBooleanAttr(attrKey)) {
return shared.includeBooleanAttr(value) ? ` ${attrKey}` : ``;
} else if (shared.isSSRSafeAttrName(attrKey)) {
return value === "" ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
} else {
console.warn(
`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`
);
return ``;
}
}
function ssrRenderAttr(key, value) {
if (!shared.isRenderableAttrValue(value)) {
return ``;
}
return ` ${key}="${shared.escapeHtml(value)}"`;
}
function ssrRenderClass(raw) {
return shared.escapeHtml(shared.normalizeClass(raw));
}
function ssrRenderStyle(raw) {
if (!raw) {
return "";
}
if (shared.isString(raw)) {
return shared.escapeHtml(raw);
}
const styles = shared.normalizeStyle(ssrResetCssVars(raw));
return shared.escapeHtml(shared.stringifyStyle(styles));
}
function ssrResetCssVars(raw) {
if (!shared.isArray(raw) && shared.isObject(raw)) {
const res = {};
for (const key in raw) {
if (key.startsWith(":--")) {
res[key.slice(1)] = shared.normalizeCssVarValue(raw[key]);
} else {
res[key] = raw[key];
}
}
return res;
}
return raw;
}
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
return renderComponentVNode(
Vue.createVNode(comp, props, children),
parentComponent,
slotScopeId
);
}
const { ensureValidVNode } = Vue.ssrUtils;
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
push(`<!--[-->`);
ssrRenderSlotInner(
slots,
slotName,
slotProps,
fallbackRenderFn,
push,
parentComponent,
slotScopeId
);
push(`<!--]-->`);
}
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
const slotFn = slots[slotName];
if (slotFn) {
const slotBuffer = [];
const bufferedPush = (item) => {
slotBuffer.push(item);
};
const ret = slotFn(
slotProps,
bufferedPush,
parentComponent,
slotScopeId ? " " + slotScopeId : ""
);
if (shared.isArray(ret)) {
const validSlotContent = ensureValidVNode(ret);
if (validSlotContent) {
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId
);
} else if (fallbackRenderFn) {
fallbackRenderFn();
} else if (transition) {
push(`<!---->`);
}
} else {
let isEmptySlot = true;
if (transition) {
isEmptySlot = false;
} else {
for (let i = 0; i < slotBuffer.length; i++) {
if (!isComment(slotBuffer[i])) {
isEmptySlot = false;
break;
}
}
}
if (isEmptySlot) {
if (fallbackRenderFn) {
fallbackRenderFn();
}
} else {
let start = 0;
let end = slotBuffer.length;
if (transition && slotBuffer[0] === "<!--[-->" && slotBuffer[end - 1] === "<!--]-->") {
start++;
end--;
}
if (start < end) {
for (let i = start; i < end; i++) {
push(slotBuffer[i]);
}
} else if (transition) {
push(`<!---->`);
}
}
}
} else if (fallbackRenderFn) {
fallbackRenderFn();
} else if (transition) {
push(`<!---->`);
}
}
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;
return !item.replace(commentRE, "").trim();
}
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
parentPush("<!--teleport start-->");
const context = parentComponent.appContext.provides[Vue.ssrContextKey];
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
const bufferIndex = targetBuffer.length;
let teleportContent;
if (disabled) {
contentRenderFn(parentPush);
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
} else {
const { getBuffer, push } = createBuffer();
push(`<!--teleport start anchor-->`);
contentRenderFn(push);
push(`<!--teleport anchor-->`);
teleportContent = getBuffer();
}
targetBuffer.splice(bufferIndex, 0, teleportContent);
parentPush("<!--teleport end-->");
}
function ssrInterpolate(value) {
return shared.escapeHtml(shared.toDisplayString(value));
}
function ssrRenderList(source, renderItem) {
if (shared.isArray(source) || shared.isString(source)) {
for (let i = 0, l = source.length; i < l; i++) {
renderItem(source[i], i);
}
} else if (typeof source === "number") {
for (let i = 0; i < source; i++) {
renderItem(i + 1, i);
}
} else if (shared.isObject(source)) {
if (source[Symbol.iterator]) {
const arr = Array.from(source);
for (let i = 0, l = arr.length; i < l; i++) {
renderItem(arr[i], i);
}
} else {
const keys = Object.keys(source);
for (let i = 0, l = keys.length; i < l; i++) {
const key = keys[i];
renderItem(source[key], key, i);
}
}
}
}
async function ssrRenderSuspense(push, { default: renderContent }) {
if (renderContent) {
renderContent();
} else {
push(`<!---->`);
}
}
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
if (typeof dir !== "function" && dir.getSSRProps) {
return dir.getSSRProps(
{
dir,
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
value,
oldValue: void 0,
arg,
modifiers
},
null
) || {};
}
return {};
}
const ssrLooseEqual = shared.looseEqual;
function ssrLooseContain(arr, value) {
return shared.looseIndexOf(arr, value) > -1;
}
function ssrRenderDynamicModel(type, model, value) {
switch (type) {
case "radio":
return shared.looseEqual(model, value) ? " checked" : "";
case "checkbox":
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? " checked" : "";
default:
return ssrRenderAttr("value", model);
}
}
function ssrGetDynamicModelProps(existingProps = {}, model) {
const { type, value } = existingProps;
switch (type) {
case "radio":
return shared.looseEqual(model, value) ? { checked: true } : null;
case "checkbox":
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? { checked: true } : null;
default:
return { value: model };
}
}
var helpers = /*#__PURE__*/Object.freeze({
__proto__: null,
ssrGetDirectiveProps: ssrGetDirectiveProps,
ssrGetDynamicModelProps: ssrGetDynamicModelProps,
ssrIncludeBooleanAttr: shared.includeBooleanAttr,
ssrInterpolate: ssrInterpolate,
ssrLooseContain: ssrLooseContain,
ssrLooseEqual: ssrLooseEqual,
ssrRenderAttr: ssrRenderAttr,
ssrRenderAttrs: ssrRenderAttrs,
ssrRenderClass: ssrRenderClass,
ssrRenderComponent: ssrRenderComponent,
ssrRenderDynamicAttr: ssrRenderDynamicAttr,
ssrRenderDynamicModel: ssrRenderDynamicModel,
ssrRenderList: ssrRenderList,
ssrRenderSlot: ssrRenderSlot,
ssrRenderSlotInner: ssrRenderSlotInner,
ssrRenderStyle: ssrRenderStyle,
ssrRenderSuspense: ssrRenderSuspense,
ssrRenderTeleport: ssrRenderTeleport,
ssrRenderVNode: renderVNode
});
const compileCache = /* @__PURE__ */ Object.create(null);
function ssrCompile(template, instance) {
const Component = instance.type;
const { isCustomElement, compilerOptions } = instance.appContext.config;
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
const finalCompilerOptions = shared.extend(
shared.extend(
{
isCustomElement,
delimiters
},
compilerOptions
),
componentCompilerOptions
);
finalCompilerOptions.isCustomElement = finalCompilerOptions.isCustomElement || shared.NO;
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
const cacheKey = JSON.stringify(
{
template,
compilerOptions: finalCompilerOptions
},
(key, value) => {
return shared.isFunction(value) ? value.toString() : value;
}
);
const cached = compileCache[cacheKey];
if (cached) {
return cached;
}
finalCompilerOptions.onError = (err) => {
{
throw err;
}
};
const { code } = compilerSsr.compile(template, finalCompilerOptions);
const requireMap = {
vue: Vue__namespace,
"vue/server-renderer": helpers
};
const fakeRequire = (id) => requireMap[id];
return compileCache[cacheKey] = Function("require", code)(fakeRequire);
}
const {
createComponentInstance,
setCurrentRenderingInstance,
setupComponent,
renderComponentRoot,
normalizeVNode,
pushWarningContext,
popWarningContext
} = Vue.ssrUtils;
function createBuffer() {
let appendable = false;
const buffer = [];
return {
getBuffer() {
return buffer;
},
push(item) {
const isStringItem = shared.isString(item);
if (appendable && isStringItem) {
buffer[buffer.length - 1] += item;
return;
}
buffer.push(item);
appendable = isStringItem;
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
buffer.hasAsync = true;
}
}
};
}
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
const instance = vnode.component = createComponentInstance(
vnode,
parentComponent,
null
);
const res = setupComponent(
instance,
true
/* isSSR */
);
const hasAsyncSetup = shared.isPromise(res);
let prefetches = instance.sp;
if (hasAsyncSetup || prefetches) {
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);
}
}
function renderComponentSubTree(instance, slotScopeId) {
const comp = instance.type;
const { getBuffer, push } = createBuffer();
if (shared.isFunction(comp)) {
let root = renderComponentRoot(instance);
if (!comp.props) {
for (const key in instance.attrs) {
if (key.startsWith(`data-v-`)) {
(root.props || (root.props = {}))[key] = ``;
}
}
}
renderVNode(push, instance.subTree = root, instance, slotScopeId);
} else {
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
comp.ssrRender = ssrCompile(comp.template, instance);
}
const ssrRender = instance.ssrRender || comp.ssrRender;
if (ssrRender) {
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
let hasCloned = false;
let cur = instance;
while (true) {
const scopeId = cur.vnode.scopeId;
if (scopeId) {
if (!hasCloned) {
attrs = { ...attrs };
hasCloned = true;
}
attrs[scopeId] = "";
}
const parent = cur.parent;
if (parent && parent.subTree && parent.subTree === cur.vnode) {
cur = parent;
} else {
break;
}
}
if (slotScopeId) {
if (!hasCloned) attrs = { ...attrs };
const slotScopeIdList = slotScopeId.trim().split(" ");
for (let i = 0; i < slotScopeIdList.length; i++) {
attrs[slotScopeIdList[i]] = "";
}
}
const prev = setCurrentRenderingInstance(instance);
try {
ssrRender(
instance.proxy,
push,
instance,
attrs,
// compiler-optimized bindings
instance.props,
instance.setupState,
instance.data,
instance.ctx
);
} finally {
setCurrentRenderingInstance(prev);
}
} else if (instance.render && instance.render !== shared.NOOP) {
renderVNode(
push,
instance.subTree = renderComponentRoot(instance),
instance,
slotScopeId
);
} else {
const componentName = comp.name || comp.__file || `<Anonymous>`;
Vue.warn(`Component ${componentName} is missing template or render function.`);
push(`<!---->`);
}
}
return getBuffer();
}
function renderVNode(push, vnode, parentComponent, slotScopeId) {
const { type, shapeFlag, children, dirs, props } = vnode;
if (dirs) {
vnode.props = applySSRDirectives(vnode, props, dirs);
}
switch (type) {
case Vue.Text:
push(shared.escapeHtml(children));
break;
case Vue.Comment:
push(
children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`
);
break;
case Vue.Static:
push(children);
break;
case Vue.Fragment:
if (vnode.slotScopeIds) {
slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
}
push(`<!--[-->`);
renderVNodeChildren(
push,
children,
parentComponent,
slotScopeId
);
push(`<!--]-->`);
break;
default:
if (shapeFlag & 1) {
renderElementVNode(push, vnode, parentComponent, slotScopeId);
} else if (shapeFlag & 6) {
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
} else if (shapeFlag & 64) {
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
} else if (shapeFlag & 128) {
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
} else {
Vue.warn(
"[@vue/server-renderer] Invalid VNode type:",
type,
`(${typeof type})`
);
}
}
}
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
for (let i = 0; i < children.length; i++) {
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
}
}
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
const tag = vnode.type;
let { props, children, shapeFlag, scopeId } = vnode;
let openTag = `<${tag}`;
if (props) {
openTag += ssrRenderAttrs(props, tag);
}
if (scopeId) {
openTag += ` ${scopeId}`;
}
let curParent = parentComponent;
let curVnode = vnode;
while (curParent && curVnode === curParent.subTree) {
curVnode = curParent.vnode;
if (curVnode.scopeId) {
openTag += ` ${curVnode.scopeId}`;
}
curParent = curParent.parent;
}
if (slotScopeId) {
openTag += ` ${slotScopeId}`;
}
push(openTag + `>`);
if (!shared.isVoidTag(tag)) {
let hasChildrenOverride = false;
if (props) {
if (props.innerHTML) {
hasChildrenOverride = true;
push(props.innerHTML);
} else if (props.textContent) {
hasChildrenOverride = true;
push(shared.escapeHtml(props.textContent));
} else if (tag === "textarea" && props.value) {
hasChildrenOverride = true;
push(shared.escapeHtml(props.value));
}
}
if (!hasChildrenOverride) {
if (shapeFlag & 8) {
push(shared.escapeHtml(children));
} else if (shapeFlag & 16) {
renderVNodeChildren(
push,
children,
parentComponent,
slotScopeId
);
}
}
push(`</${tag}>`);
}
}
function applySSRDirectives(vnode, rawProps, dirs) {
const toMerge = [];
for (let i = 0; i < dirs.length; i++) {
const binding = dirs[i];
const {
dir: { getSSRProps }
} = binding;
if (getSSRProps) {
const props = getSSRProps(binding, vnode);
if (props) toMerge.push(props);
}
}
return Vue.mergeProps(rawProps || {}, ...toMerge);
}
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
const target = vnode.props && vnode.props.to;
const disabled = vnode.props && vnode.props.disabled;
if (!target) {
if (!disabled) {
Vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
}
return [];
}
if (!shared.isString(target)) {
Vue.warn(
`[@vue/server-renderer] Teleport target must be a query selector string.`
);
return [];
}
ssrRenderTeleport(
push,
(push2) => {
renderVNodeChildren(
push2,
vnode.children,
parentComponent,
slotScopeId
);
},
target,
disabled || disabled === "",
parentComponent
);
}
const { isVNode: isVNode$1 } = Vue.ssrUtils;
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 = "";
for (let i = 0; i < buffer.length; i++) {
let item = buffer[i];
if (shared.isString(item)) {
ret += item;
} else {
ret += unrollBufferSync$1(item);
}
}
return ret;
}
async function renderToString(input, context = {}) {
if (isVNode$1(input)) {
return renderToString(Vue.createApp({ render: () => input }), context);
}
const vnode = Vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
input.provide(Vue.ssrContextKey, context);
const buffer = await renderComponentVNode(vnode);
const result = await unrollBuffer$1(buffer);
await resolveTeleports(context);
if (context.__watcherHandles) {
for (const unwatch of context.__watcherHandles) {
unwatch();
}
}
return result;
}
async function resolveTeleports(context) {
if (context.__teleportBuffers) {
context.teleports = context.teleports || {};
for (const key in context.__teleportBuffers) {
context.teleports[key] = await unrollBuffer$1(
await Promise.all([context.__teleportBuffers[key]])
);
}
}
}
const { isVNode } = Vue.ssrUtils;
async function unrollBuffer(buffer, stream) {
if (buffer.hasAsync) {
for (let i = 0; i < buffer.length; i++) {
let item = buffer[i];
if (shared.isPromise(item)) {
item = await item;
}
if (shared.isString(item)) {
stream.push(item);
} else {
await unrollBuffer(item, stream);
}
}
} else {
unrollBufferSync(buffer, stream);
}
}
function unrollBufferSync(buffer, stream) {
for (let i = 0; i < buffer.length; i++) {
let item = buffer[i];
if (shared.isString(item)) {
stream.push(item);
} else {
unrollBufferSync(item, stream);
}
}
}
function renderToSimpleStream(input, context, stream) {
if (isVNode(input)) {
return renderToSimpleStream(
Vue.createApp({ render: () => input }),
context,
stream
);
}
const vnode = Vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
input.provide(Vue.ssrContextKey, context);
Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
if (context.__watcherHandles) {
for (const unwatch of context.__watcherHandles) {
unwatch();
}
}
}).then(() => stream.push(null)).catch((error) => {
stream.destroy(error);
});
return stream;
}
function renderToStream(input, context = {}) {
console.warn(
`[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`
);
return renderToNodeStream(input, context);
}
function renderToNodeStream(input, context = {}) {
const stream = new (require("node:stream")).Readable({ read() {
} }) ;
if (!stream) {
throw new Error(
`ESM build of renderToStream() does not support renderToNodeStream(). Use pipeToNodeWritable() with an existing Node.js Writable stream instance instead.`
);
}
return renderToSimpleStream(input, context, stream);
}
function pipeToNodeWritable(input, context = {}, writable) {
renderToSimpleStream(input, context, {
push(content) {
if (content != null) {
writable.write(content);
} else {
writable.end();
}
},
destroy(err) {
writable.destroy(err);
}
});
}
function renderToWebStream(input, context = {}) {
if (typeof ReadableStream !== "function") {
throw new Error(
`ReadableStream constructor is not available in the global scope. If the target environment does support web streams, consider using pipeToWebWritable() with an existing WritableStream instance instead.`
);
}
const encoder = new TextEncoder();
let cancelled = false;
return new ReadableStream({
start(controller) {
renderToSimpleStream(input, context, {
push(content) {
if (cancelled) return;
if (content != null) {
controller.enqueue(encoder.encode(content));
} else {
controller.close();
}
},
destroy(err) {
controller.error(err);
}
});
},
cancel() {
cancelled = true;
}
});
}
function pipeToWebWritable(input, context = {}, writable) {
const writer = writable.getWriter();
const encoder = new TextEncoder();
let hasReady = false;
try {
hasReady = shared.isPromise(writer.ready);
} catch (e) {
}
renderToSimpleStream(input, context, {
async push(content) {
if (hasReady) {
await writer.ready;
}
if (content != null) {
return writer.write(encoder.encode(content));
} else {
return writer.close();
}
},
destroy(err) {
console.log(err);
writer.close();
}
});
}
Vue.initDirectivesForSSR();
exports.ssrIncludeBooleanAttr = shared.includeBooleanAttr;
exports.pipeToNodeWritable = pipeToNodeWritable;
exports.pipeToWebWritable = pipeToWebWritable;
exports.renderToNodeStream = renderToNodeStream;
exports.renderToSimpleStream = renderToSimpleStream;
exports.renderToStream = renderToStream;
exports.renderToString = renderToString;
exports.renderToWebStream = renderToWebStream;
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
exports.ssrInterpolate = ssrInterpolate;
exports.ssrLooseContain = ssrLooseContain;
exports.ssrLooseEqual = ssrLooseEqual;
exports.ssrRenderAttr = ssrRenderAttr;
exports.ssrRenderAttrs = ssrRenderAttrs;
exports.ssrRenderClass = ssrRenderClass;
exports.ssrRenderComponent = ssrRenderComponent;
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
exports.ssrRenderList = ssrRenderList;
exports.ssrRenderSlot = ssrRenderSlot;
exports.ssrRenderSlotInner = ssrRenderSlotInner;
exports.ssrRenderStyle = ssrRenderStyle;
exports.ssrRenderSuspense = ssrRenderSuspense;
exports.ssrRenderTeleport = ssrRenderTeleport;
exports.ssrRenderVNode = renderVNode;

View File

@@ -0,0 +1,55 @@
{
"name": "@vue/server-renderer",
"version": "3.5.28",
"description": "@vue/server-renderer",
"main": "index.js",
"module": "dist/server-renderer.esm-bundler.js",
"types": "dist/server-renderer.d.ts",
"files": [
"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": [
"esm-bundler",
"esm-browser",
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/server-renderer"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.5.28"
},
"dependencies": {
"@vue/shared": "3.5.28",
"@vue/compiler-ssr": "3.5.28"
}
}

View File

@@ -0,0 +1,604 @@
/**
* @vue/shared v3.5.28
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
};
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
const isModelListener = (key) => key.startsWith("onUpdate:");
const extend = Object.assign;
const remove = (arr, el) => {
const i = arr.indexOf(el);
if (i > -1) {
arr.splice(i, 1);
}
};
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
const isArray = Array.isArray;
const isMap = (val) => toTypeString(val) === "[object Map]";
const isSet = (val) => toTypeString(val) === "[object Set]";
const isDate = (val) => toTypeString(val) === "[object Date]";
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isSymbol = (val) => typeof val === "symbol";
const isObject = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
const toRawType = (value) => {
return toTypeString(value).slice(8, -1);
};
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
const isReservedProp = /* @__PURE__ */ makeMap(
// the leading comma is intentional so empty string "" is also included
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
);
const isBuiltInDirective = /* @__PURE__ */ makeMap(
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
);
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null);
return ((str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
});
};
const camelizeRE = /-\w/g;
const camelize = cacheStringFunction(
(str) => {
return str.replace(camelizeRE, (c) => c.slice(1).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, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
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)}]`;
}
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`,
[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]: `CACHED`,
[-2]: `BAIL`
};
const ShapeFlags = {
"ELEMENT": 1,
"1": "ELEMENT",
"FUNCTIONAL_COMPONENT": 2,
"2": "FUNCTIONAL_COMPONENT",
"STATEFUL_COMPONENT": 4,
"4": "STATEFUL_COMPONENT",
"TEXT_CHILDREN": 8,
"8": "TEXT_CHILDREN",
"ARRAY_CHILDREN": 16,
"16": "ARRAY_CHILDREN",
"SLOTS_CHILDREN": 32,
"32": "SLOTS_CHILDREN",
"TELEPORT": 64,
"64": "TELEPORT",
"SUSPENSE": 128,
"128": "SUSPENSE",
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
"COMPONENT_KEPT_ALIVE": 512,
"512": "COMPONENT_KEPT_ALIVE",
"COMPONENT": 6,
"6": "COMPONENT"
};
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
const slotFlagsText = {
[1]: "STABLE",
[2]: "DYNAMIC",
[3]: "FORWARDED"
};
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,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);
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) {
if (!styles) return "";
if (isString(styles)) return styles;
let ret = "";
for (const key in styles) {
const value = styles[key];
if (isString(value) || typeof value === "number") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
ret += `${normalizedKey}:${value};`;
}
}
return ret;
}
function normalizeClass(value) {
let res = "";
if (isString(value)) {
res = value;
} else if (isArray(value)) {
for (let i = 0; i < value.length; i++) {
const normalized = normalizeClass(value[i]);
if (normalized) {
res += normalized + " ";
}
}
} else if (isObject(value)) {
for (const name in value) {
if (value[name]) {
res += name + " ";
}
}
}
return res.trim();
}
function normalizeProps(props) {
if (!props) return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
}
if (style) {
props.style = normalizeStyle(style);
}
return props;
}
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
const isBooleanAttr = /* @__PURE__ */ makeMap(
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
);
function includeBooleanAttr(value) {
return !!value || value === "";
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
const attrValidationCache = {};
function isSSRSafeAttrName(name) {
if (attrValidationCache.hasOwnProperty(name)) {
return attrValidationCache[name];
}
const isUnsafe = unsafeAttrCharRE.test(name);
if (isUnsafe) {
console.error(`unsafe attribute name: ${name}`);
}
return attrValidationCache[name] = !isUnsafe;
}
const propsToAttrMap = {
acceptCharset: "accept-charset",
className: "class",
htmlFor: "for",
httpEquiv: "http-equiv"
};
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
);
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
const 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) {
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, "");
}
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;
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 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)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (isRef(val)) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
[`Map(${val.size})`]: [...val.entries()].reduce(
(entries, [key, val2], i) => {
entries[stringifySymbol(key, i) + " =>"] = val2;
return entries;
},
{}
)
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
};
} else if (isSymbol(val)) {
return stringifySymbol(val);
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const stringifySymbol = (v, i = "") => {
var _a;
return (
// 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
);
};
function normalizeCssVarValue(value) {
if (value == null) {
return "initial";
}
if (typeof value === "string") {
return value === "" ? " " : value;
}
return String(value);
}
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;
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.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;
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.normalizeCssVarValue = normalizeCssVarValue;
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;

47
.output/server/node_modules/@vue/shared/package.json generated vendored Normal file
View File

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

4
.output/server/node_modules/devalue/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export { uneval } from './src/uneval.js';
export { parse, unflatten } from './src/parse.js';
export { stringify } from './src/stringify.js';
export { DevalueError } from './src/utils.js';

37
.output/server/node_modules/devalue/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "devalue",
"description": "Gets the job done when JSON.stringify can't",
"version": "5.6.2",
"repository": "sveltejs/devalue",
"sideEffects": false,
"exports": {
".": {
"types": "./types/index.d.ts",
"import": "./index.js",
"default": "./index.js"
}
},
"files": [
"index.js",
"src",
"types"
],
"types": "./types/index.d.ts",
"devDependencies": {
"@changesets/cli": "^2.29.6",
"@js-temporal/polyfill": "^0.5.1",
"dts-buddy": "^0.6.2",
"publint": "^0.3.12",
"typescript": "^5.9.2",
"uvu": "^0.5.6"
},
"license": "MIT",
"type": "module",
"packageManager": "pnpm@8.15.9",
"scripts": {
"changeset:version": "changeset version",
"changeset:publish": "changeset publish",
"build": "dts-buddy",
"test": "uvu test"
}
}

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

6
.output/server/node_modules/devalue/src/constants.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export const UNDEFINED = -1;
export const HOLE = -2;
export const NAN = -3;
export const POSITIVE_INFINITY = -4;
export const NEGATIVE_INFINITY = -5;
export const NEGATIVE_ZERO = -6;

234
.output/server/node_modules/devalue/src/parse.js generated vendored Normal file
View File

@@ -0,0 +1,234 @@
import { decode64 } from './base64.js';
import {
HOLE,
NAN,
NEGATIVE_INFINITY,
NEGATIVE_ZERO,
POSITIVE_INFINITY,
UNDEFINED
} from './constants.js';
/**
* Revive a value serialized with `devalue.stringify`
* @param {string} serialized
* @param {Record<string, (value: any) => any>} [revivers]
*/
export function parse(serialized, revivers) {
return unflatten(JSON.parse(serialized), revivers);
}
/**
* Revive a value flattened with `devalue.stringify`
* @param {number | any[]} parsed
* @param {Record<string, (value: any) => any>} [revivers]
*/
export function unflatten(parsed, revivers) {
if (typeof parsed === 'number') return hydrate(parsed, true);
if (!Array.isArray(parsed) || parsed.length === 0) {
throw new Error('Invalid input');
}
const values = /** @type {any[]} */ (parsed);
const hydrated = Array(values.length);
/**
* A set of values currently being hydrated with custom revivers,
* used to detect invalid cyclical dependencies
* @type {Set<number> | null}
*/
let hydrating = null;
/**
* @param {number} index
* @returns {any}
*/
function hydrate(index, standalone = false) {
if (index === UNDEFINED) return undefined;
if (index === NAN) return NaN;
if (index === POSITIVE_INFINITY) return Infinity;
if (index === NEGATIVE_INFINITY) return -Infinity;
if (index === NEGATIVE_ZERO) return -0;
if (standalone || typeof index !== 'number') {
throw new Error(`Invalid input`);
}
if (index in hydrated) return hydrated[index];
const value = values[index];
if (!value || typeof value !== 'object') {
hydrated[index] = value;
} else if (Array.isArray(value)) {
if (typeof value[0] === 'string') {
const type = value[0];
const reviver =
revivers && Object.hasOwn(revivers, type)
? revivers[type]
: undefined;
if (reviver) {
let i = value[1];
if (typeof i !== 'number') {
// if it's not a number, it was serialized by a builtin reviver
// so we need to munge it into the format expected by a custom reviver
i = values.push(value[1]) - 1;
}
hydrating ??= new Set();
if (hydrating.has(i)) {
throw new Error('Invalid circular reference');
}
hydrating.add(i);
hydrated[index] = reviver(hydrate(i));
hydrating.delete(i);
return hydrated[index];
}
switch (type) {
case 'Date':
hydrated[index] = new Date(value[1]);
break;
case 'Set':
const set = new Set();
hydrated[index] = set;
for (let i = 1; i < value.length; i += 1) {
set.add(hydrate(value[i]));
}
break;
case 'Map':
const map = new Map();
hydrated[index] = map;
for (let i = 1; i < value.length; i += 2) {
map.set(hydrate(value[i]), hydrate(value[i + 1]));
}
break;
case 'RegExp':
hydrated[index] = new RegExp(value[1], value[2]);
break;
case 'Object':
hydrated[index] = Object(value[1]);
break;
case 'BigInt':
hydrated[index] = BigInt(value[1]);
break;
case 'null':
const obj = Object.create(null);
hydrated[index] = obj;
for (let i = 1; i < value.length; i += 2) {
obj[value[i]] = hydrate(value[i + 1]);
}
break;
case 'Int8Array':
case 'Uint8Array':
case 'Uint8ClampedArray':
case 'Int16Array':
case 'Uint16Array':
case 'Int32Array':
case 'Uint32Array':
case 'Float32Array':
case 'Float64Array':
case 'BigInt64Array':
case 'BigUint64Array': {
if (values[value[1]][0] !== 'ArrayBuffer') {
// without this, if we receive malformed input we could
// end up trying to hydrate in a circle or allocate
// huge amounts of memory when we call `new TypedArrayConstructor(buffer)`
throw new Error('Invalid data');
}
const TypedArrayConstructor = globalThis[type];
const buffer = hydrate(value[1]);
const typedArray = new TypedArrayConstructor(buffer);
hydrated[index] =
value[2] !== undefined
? typedArray.subarray(value[2], value[3])
: typedArray;
break;
}
case 'ArrayBuffer': {
const base64 = value[1];
if (typeof base64 !== 'string') {
throw new Error('Invalid ArrayBuffer encoding');
}
const arraybuffer = decode64(base64);
hydrated[index] = arraybuffer;
break;
}
case 'Temporal.Duration':
case 'Temporal.Instant':
case 'Temporal.PlainDate':
case 'Temporal.PlainTime':
case 'Temporal.PlainDateTime':
case 'Temporal.PlainMonthDay':
case 'Temporal.PlainYearMonth':
case 'Temporal.ZonedDateTime': {
const temporalName = type.slice(9);
// @ts-expect-error TS doesn't know about Temporal yet
hydrated[index] = Temporal[temporalName].from(value[1]);
break;
}
case 'URL': {
const url = new URL(value[1]);
hydrated[index] = url;
break;
}
case 'URLSearchParams': {
const url = new URLSearchParams(value[1]);
hydrated[index] = url;
break;
}
default:
throw new Error(`Unknown type ${type}`);
}
} else {
const array = new Array(value.length);
hydrated[index] = array;
for (let i = 0; i < value.length; i += 1) {
const n = value[i];
if (n === HOLE) continue;
array[i] = hydrate(n);
}
}
} else {
/** @type {Record<string, any>} */
const object = {};
hydrated[index] = object;
for (const key in value) {
if (key === '__proto__') {
throw new Error('Cannot parse an object with a `__proto__` property');
}
const n = value[key];
object[key] = hydrate(n);
}
}
return hydrated[index];
}
return hydrate(0);
}

265
.output/server/node_modules/devalue/src/stringify.js generated vendored Normal file
View File

@@ -0,0 +1,265 @@
import {
DevalueError,
enumerable_symbols,
get_type,
is_plain_object,
is_primitive,
stringify_key,
stringify_string
} from './utils.js';
import {
HOLE,
NAN,
NEGATIVE_INFINITY,
NEGATIVE_ZERO,
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`
* @param {any} value
* @param {Record<string, (value: any) => any>} [reducers]
*/
export function stringify(value, reducers) {
/** @type {any[]} */
const stringified = [];
/** @type {Map<any, number>} */
const indexes = new Map();
/** @type {Array<{ key: string, fn: (value: any) => any }>} */
const custom = [];
if (reducers) {
for (const key of Object.getOwnPropertyNames(reducers)) {
custom.push({ key, fn: reducers[key] });
}
}
/** @type {string[]} */
const keys = [];
let p = 0;
/** @param {any} thing */
function flatten(thing) {
if (thing === undefined) return UNDEFINED;
if (Number.isNaN(thing)) return NAN;
if (thing === Infinity) return POSITIVE_INFINITY;
if (thing === -Infinity) return NEGATIVE_INFINITY;
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;
if (indexes.has(thing)) return indexes.get(thing);
const index = p++;
indexes.set(thing, index);
for (const { key, fn } of custom) {
const value = fn(thing);
if (value) {
stringified[index] = `["${key}",${flatten(value)}]`;
return index;
}
}
if (typeof thing === 'function') {
throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
}
let str = '';
if (is_primitive(thing)) {
str = stringify_primitive(thing);
} else {
const type = get_type(thing);
switch (type) {
case 'Number':
case 'String':
case 'Boolean':
str = `["Object",${stringify_primitive(thing)}]`;
break;
case 'BigInt':
str = `["BigInt",${thing}]`;
break;
case 'Date':
const valid = !isNaN(thing.getDate());
str = `["Date","${valid ? thing.toISOString() : ''}"]`;
break;
case 'URL':
str = `["URL",${stringify_string(thing.toString())}]`;
break;
case 'URLSearchParams':
str = `["URLSearchParams",${stringify_string(thing.toString())}]`;
break;
case 'RegExp':
const { source, flags } = thing;
str = flags
? `["RegExp",${stringify_string(source)},"${flags}"]`
: `["RegExp",${stringify_string(source)}]`;
break;
case 'Array':
str = '[';
for (let i = 0; i < thing.length; i += 1) {
if (i > 0) str += ',';
if (i in thing) {
keys.push(`[${i}]`);
str += flatten(thing[i]);
keys.pop();
} else {
str += HOLE;
}
}
str += ']';
break;
case 'Set':
str = '["Set"';
for (const value of thing) {
str += `,${flatten(value)}`;
}
str += ']';
break;
case 'Map':
str = '["Map"';
for (const [key, value] of thing) {
keys.push(
`.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;
str = '["' + type + '",' + flatten(typedArray.buffer);
const a = thing.byteOffset;
const b = a + thing.byteLength;
// handle subarrays
if (a > 0 || b !== typedArray.buffer.byteLength) {
const m = +/(\d+)/.exec(type)[1] / 8;
str += `,${a / m},${b / m}`;
}
str += ']';
break;
}
case 'ArrayBuffer': {
/** @type {ArrayBuffer} */
const arraybuffer = thing;
const base64 = encode64(arraybuffer);
str = `["ArrayBuffer","${base64}"]`;
break;
}
case 'Temporal.Duration':
case 'Temporal.Instant':
case 'Temporal.PlainDate':
case 'Temporal.PlainTime':
case 'Temporal.PlainDateTime':
case 'Temporal.PlainMonthDay':
case 'Temporal.PlainYearMonth':
case 'Temporal.ZonedDateTime':
str = `["${type}",${stringify_string(thing.toString())}]`;
break;
default:
if (!is_plain_object(thing)) {
throw new DevalueError(
`Cannot stringify arbitrary non-POJOs`,
keys,
thing,
value
);
}
if (enumerable_symbols(thing).length > 0) {
throw new DevalueError(
`Cannot stringify POJOs with symbolic keys`,
keys,
thing,
value
);
}
if (Object.getPrototypeOf(thing) === null) {
str = '["null"';
for (const key in thing) {
keys.push(stringify_key(key));
str += `,${stringify_string(key)},${flatten(thing[key])}`;
keys.pop();
}
str += ']';
} else {
str = '{';
let started = false;
for (const key in thing) {
if (started) str += ',';
started = true;
keys.push(stringify_key(key));
str += `${stringify_string(key)}:${flatten(thing[key])}`;
keys.pop();
}
str += '}';
}
}
}
stringified[index] = str;
return index;
}
const index = flatten(value);
// special case — value is represented as a negative index
if (index < 0) return `${index}`;
return `[${stringified.join(',')}]`;
}
/**
* @param {any} thing
* @returns {string}
*/
function stringify_primitive(thing) {
const type = typeof thing;
if (type === 'string') return stringify_string(thing);
if (thing instanceof String) return stringify_string(thing.toString());
if (thing === void 0) return UNDEFINED.toString();
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
if (type === 'bigint') return `["BigInt","${thing}"]`;
return String(thing);
}

407
.output/server/node_modules/devalue/src/uneval.js generated vendored Normal file
View File

@@ -0,0 +1,407 @@
import {
DevalueError,
enumerable_symbols,
escaped,
get_type,
is_plain_object,
is_primitive,
stringify_key,
stringify_string
} from './utils.js';
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
const reserved =
/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
/**
* Turn a value into the JavaScript that creates an equivalent value
* @param {any} value
* @param {(value: any, uneval: (value: any) => string) => string | void} [replacer]
*/
export function uneval(value, replacer) {
const counts = new Map();
/** @type {string[]} */
const keys = [];
const custom = new Map();
/** @param {any} thing */
function walk(thing) {
if (!is_primitive(thing)) {
if (counts.has(thing)) {
counts.set(thing, counts.get(thing) + 1);
return;
}
counts.set(thing, 1);
if (replacer) {
const str = replacer(thing, (value) => uneval(value, replacer));
if (typeof str === 'string') {
custom.set(thing, str);
return;
}
}
if (typeof thing === 'function') {
throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
}
const type = get_type(thing);
switch (type) {
case 'Number':
case 'BigInt':
case 'String':
case 'Boolean':
case 'Date':
case 'RegExp':
case 'URL':
case 'URLSearchParams':
return;
case 'Array':
/** @type {any[]} */ (thing).forEach((value, i) => {
keys.push(`[${i}]`);
walk(value);
keys.pop();
});
break;
case 'Set':
Array.from(thing).forEach(walk);
break;
case 'Map':
for (const [key, value] of thing) {
keys.push(
`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`
);
walk(value);
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':
walk(thing.buffer);
return;
case 'ArrayBuffer':
return;
case 'Temporal.Duration':
case 'Temporal.Instant':
case 'Temporal.PlainDate':
case 'Temporal.PlainTime':
case 'Temporal.PlainDateTime':
case 'Temporal.PlainMonthDay':
case 'Temporal.PlainYearMonth':
case 'Temporal.ZonedDateTime':
return;
default:
if (!is_plain_object(thing)) {
throw new DevalueError(
`Cannot stringify arbitrary non-POJOs`,
keys,
thing,
value
);
}
if (enumerable_symbols(thing).length > 0) {
throw new DevalueError(
`Cannot stringify POJOs with symbolic keys`,
keys,
thing,
value
);
}
for (const key in thing) {
keys.push(stringify_key(key));
walk(thing[key]);
keys.pop();
}
}
}
}
walk(value);
const names = new Map();
Array.from(counts)
.filter((entry) => entry[1] > 1)
.sort((a, b) => b[1] - a[1])
.forEach((entry, i) => {
names.set(entry[0], get_name(i));
});
/**
* @param {any} thing
* @returns {string}
*/
function stringify(thing) {
if (names.has(thing)) {
return names.get(thing);
}
if (is_primitive(thing)) {
return stringify_primitive(thing);
}
if (custom.has(thing)) {
return custom.get(thing);
}
const type = get_type(thing);
switch (type) {
case 'Number':
case 'String':
case 'Boolean':
return `Object(${stringify(thing.valueOf())})`;
case 'RegExp':
return `new RegExp(${stringify_string(thing.source)}, "${
thing.flags
}")`;
case 'Date':
return `new Date(${thing.getTime()})`;
case 'URL':
return `new URL(${stringify_string(thing.toString())})`;
case 'URLSearchParams':
return `new URLSearchParams(${stringify_string(thing.toString())})`;
case 'Array':
const members = /** @type {any[]} */ (thing).map((v, i) =>
i in thing ? stringify(v) : ''
);
const tail = thing.length === 0 || thing.length - 1 in thing ? '' : ',';
return `[${members.join(',')}${tail}]`;
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': {
let str = `new ${type}`;
if (counts.get(thing.buffer) === 1) {
const array = new thing.constructor(thing.buffer);
str += `([${array}])`;
} else {
str += `([${stringify(thing.buffer)}])`;
}
const a = thing.byteOffset;
const b = a + thing.byteLength;
// handle subarrays
if (a > 0 || b !== thing.buffer.byteLength) {
const m = +/(\d+)/.exec(type)[1] / 8;
str += `.subarray(${a / m},${b / m})`;
}
return str;
}
case 'ArrayBuffer': {
const ui8 = new Uint8Array(thing);
return `new Uint8Array([${ui8.toString()}]).buffer`;
}
case 'Temporal.Duration':
case 'Temporal.Instant':
case 'Temporal.PlainDate':
case 'Temporal.PlainTime':
case 'Temporal.PlainDateTime':
case 'Temporal.PlainMonthDay':
case 'Temporal.PlainYearMonth':
case 'Temporal.ZonedDateTime':
return `${type}.from(${stringify_string(thing.toString())})`;
default:
const keys = Object.keys(thing);
const obj = keys
.map((key) => `${safe_key(key)}:${stringify(thing[key])}`)
.join(',');
const proto = Object.getPrototypeOf(thing);
if (proto === null) {
return keys.length > 0
? `{${obj},__proto__:null}`
: `{__proto__:null}`;
}
return `{${obj}}`;
}
}
const str = stringify(value);
if (names.size) {
/** @type {string[]} */
const params = [];
/** @type {string[]} */
const statements = [];
/** @type {string[]} */
const values = [];
names.forEach((name, thing) => {
params.push(name);
if (custom.has(thing)) {
values.push(/** @type {string} */ (custom.get(thing)));
return;
}
if (is_primitive(thing)) {
values.push(stringify_primitive(thing));
return;
}
const type = get_type(thing);
switch (type) {
case 'Number':
case 'String':
case 'Boolean':
values.push(`Object(${stringify(thing.valueOf())})`);
break;
case 'RegExp':
values.push(thing.toString());
break;
case 'Date':
values.push(`new Date(${thing.getTime()})`);
break;
case 'Array':
values.push(`Array(${thing.length})`);
/** @type {any[]} */ (thing).forEach((v, i) => {
statements.push(`${name}[${i}]=${stringify(v)}`);
});
break;
case 'Set':
values.push(`new Set`);
statements.push(
`${name}.${Array.from(thing)
.map((v) => `add(${stringify(v)})`)
.join('.')}`
);
break;
case 'Map':
values.push(`new Map`);
statements.push(
`${name}.${Array.from(thing)
.map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`)
.join('.')}`
);
break;
case 'ArrayBuffer':
values.push(
`new Uint8Array([${new Uint8Array(thing).join(',')}]).buffer`
);
break;
default:
values.push(
Object.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}'
);
Object.keys(thing).forEach((key) => {
statements.push(
`${name}${safe_prop(key)}=${stringify(thing[key])}`
);
});
}
});
statements.push(`return ${str}`);
return `(function(${params.join(',')}){${statements.join(
';'
)}}(${values.join(',')}))`;
} else {
return str;
}
}
/** @param {number} num */
function get_name(num) {
let name = '';
do {
name = chars[num % chars.length] + name;
num = ~~(num / chars.length) - 1;
} while (num >= 0);
return reserved.test(name) ? `${name}0` : name;
}
/** @param {string} c */
function escape_unsafe_char(c) {
return escaped[c] || c;
}
/** @param {string} str */
function escape_unsafe_chars(str) {
return str.replace(unsafe_chars, escape_unsafe_char);
}
/** @param {string} key */
function safe_key(key) {
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)
? key
: escape_unsafe_chars(JSON.stringify(key));
}
/** @param {string} key */
function safe_prop(key) {
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)
? `.${key}`
: `[${escape_unsafe_chars(JSON.stringify(key))}]`;
}
/** @param {any} thing */
function stringify_primitive(thing) {
if (typeof thing === 'string') return stringify_string(thing);
if (thing === void 0) return 'void 0';
if (thing === 0 && 1 / thing < 0) return '-0';
const str = String(thing);
if (typeof thing === 'number') return str.replace(/^(-)?0\./, '$1.');
if (typeof thing === 'bigint') return thing + 'n';
return str;
}

118
.output/server/node_modules/devalue/src/utils.js generated vendored Normal file
View File

@@ -0,0 +1,118 @@
/** @type {Record<string, string>} */
export const escaped = {
'<': '\\u003C',
'\\': '\\\\',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
};
export class DevalueError extends Error {
/**
* @param {string} message
* @param {string[]} keys
* @param {any} [value] - The value that failed to be serialized
* @param {any} [root] - The root value being serialized
*/
constructor(message, keys, value, root) {
super(message);
this.name = 'DevalueError';
this.path = keys.join('');
this.value = value;
this.root = root;
}
}
/** @param {any} thing */
export function is_primitive(thing) {
return Object(thing) !== thing;
}
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(
Object.prototype
)
.sort()
.join('\0');
/** @param {any} thing */
export function is_plain_object(thing) {
const proto = Object.getPrototypeOf(thing);
return (
proto === Object.prototype ||
proto === null ||
Object.getPrototypeOf(proto) === null ||
Object.getOwnPropertyNames(proto).sort().join('\0') === object_proto_names
);
}
/** @param {any} thing */
export function get_type(thing) {
return Object.prototype.toString.call(thing).slice(8, -1);
}
/** @param {string} char */
function get_escaped_char(char) {
switch (char) {
case '"':
return '\\"';
case '<':
return '\\u003C';
case '\\':
return '\\\\';
case '\n':
return '\\n';
case '\r':
return '\\r';
case '\t':
return '\\t';
case '\b':
return '\\b';
case '\f':
return '\\f';
case '\u2028':
return '\\u2028';
case '\u2029':
return '\\u2029';
default:
return char < ' '
? `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`
: '';
}
}
/** @param {string} str */
export function stringify_string(str) {
let result = '';
let last_pos = 0;
const len = str.length;
for (let i = 0; i < len; i += 1) {
const char = str[i];
const replacement = get_escaped_char(char);
if (replacement) {
result += str.slice(last_pos, i) + replacement;
last_pos = i + 1;
}
}
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) + ']';
}

View File

@@ -0,0 +1,77 @@
"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.fromCodePoint = void 0;
exports.replaceCodePoint = replaceCodePoint;
exports.decodeCodePoint = decodeCodePoint;
const 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, n/no-unsupported-features/es-builtins
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => {
let output = "";
if (codePoint > 65535) {
codePoint -= 65536;
output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
codePoint = 56320 | (codePoint & 1023);
}
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 >= 55296 && codePoint <= 57343) ||
codePoint > 1114111) {
return 65533;
}
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
}
/**
* 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));
}
//# sourceMappingURL=decode-codepoint.js.map

View File

@@ -0,0 +1,568 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.xmlDecodeTree = exports.htmlDecodeTree = exports.replaceCodePoint = exports.fromCodePoint = exports.decodeCodePoint = exports.EntityDecoder = exports.DecodingMode = void 0;
exports.determineBranch = determineBranch;
exports.decodeHTML = decodeHTML;
exports.decodeHTMLAttribute = decodeHTMLAttribute;
exports.decodeHTMLStrict = decodeHTMLStrict;
exports.decodeXML = decodeXML;
const decode_codepoint_js_1 = require("./decode-codepoint.js");
const decode_data_html_js_1 = require("./generated/decode-data-html.js");
const decode_data_xml_js_1 = require("./generated/decode-data-xml.js");
const bin_trie_flags_js_1 = require("./internal/bin-trie-flags.js");
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 */
const TO_LOWER_BIT = 32;
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 = DecodingMode = {}));
/**
* Token decoder with support of writing partial entities.
*/
class EntityDecoder {
constructor(
/** The tree used to decode entities. */
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive
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;
/** The number of characters that have been consumed in the current run. */
this.runConsumed = 0;
}
/** Resets the instance to make it reusable. */
startEntity(decodeMode) {
this.decodeMode = decodeMode;
this.state = EntityDecoderState.EntityStart;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.consumed = 1;
this.runConsumed = 0;
}
/**
* 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 input 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.
*/
write(input, offset) {
switch (this.state) {
case EntityDecoderState.EntityStart: {
if (input.charCodeAt(offset) === CharCodes.NUM) {
this.state = EntityDecoderState.NumericStart;
this.consumed += 1;
return this.stateNumericStart(input, offset + 1);
}
this.state = EntityDecoderState.NamedEntity;
return this.stateNamedEntity(input, offset);
}
case EntityDecoderState.NumericStart: {
return this.stateNumericStart(input, offset);
}
case EntityDecoderState.NumericDecimal: {
return this.stateNumericDecimal(input, offset);
}
case EntityDecoderState.NumericHex: {
return this.stateNumericHex(input, offset);
}
case EntityDecoderState.NamedEntity: {
return this.stateNamedEntity(input, offset);
}
}
}
/**
* Switches between the numeric decimal and hexadecimal states.
*
* Equivalent to the `Numeric character reference state` in the HTML spec.
*
* @param input 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.
*/
stateNumericStart(input, offset) {
if (offset >= input.length) {
return -1;
}
if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
this.state = EntityDecoderState.NumericHex;
this.consumed += 1;
return this.stateNumericHex(input, offset + 1);
}
this.state = EntityDecoderState.NumericDecimal;
return this.stateNumericDecimal(input, offset);
}
/**
* Parses a hexadecimal numeric entity.
*
* Equivalent to the `Hexademical character reference state` in the HTML spec.
*
* @param input 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.
*/
stateNumericHex(input, offset) {
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char) || isHexadecimalCharacter(char)) {
// Convert hex digit to value (0-15); 'a'/'A' -> 10.
const digit = char <= CharCodes.NINE
? char - CharCodes.ZERO
: (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10;
this.result = this.result * 16 + digit;
this.consumed++;
offset++;
}
else {
return this.emitNumericEntity(char, 3);
}
}
return -1; // Incomplete entity
}
/**
* Parses a decimal numeric entity.
*
* Equivalent to the `Decimal character reference state` in the HTML spec.
*
* @param input 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.
*/
stateNumericDecimal(input, offset) {
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char)) {
this.result = this.result * 10 + (char - CharCodes.ZERO);
this.consumed++;
offset++;
}
else {
return this.emitNumericEntity(char, 2);
}
}
return -1; // Incomplete entity
}
/**
* 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.
*/
emitNumericEntity(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 input 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.
*/
stateNamedEntity(input, offset) {
const { decodeTree } = this;
let current = decodeTree[this.treeIndex];
// The length is the number of bytes of the value, including the current byte.
let valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
while (offset < input.length) {
// Handle compact runs (possibly inline): valueLength == 0 and SEMI_REQUIRED bit set.
if (valueLength === 0 && (current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) {
const runLength = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7; /* 2..63 */
// If we are starting a run, check the first char.
if (this.runConsumed === 0) {
const firstChar = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE;
if (input.charCodeAt(offset) !== firstChar) {
return this.result === 0
? 0
: this.emitNotTerminatedNamedEntity();
}
offset++;
this.excess++;
this.runConsumed++;
}
// Check remaining characters in the run.
while (this.runConsumed < runLength) {
if (offset >= input.length) {
return -1;
}
const charIndexInPacked = this.runConsumed - 1;
const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)];
const expectedChar = charIndexInPacked % 2 === 0
? packedWord & 0xff
: (packedWord >> 8) & 0xff;
if (input.charCodeAt(offset) !== expectedChar) {
this.runConsumed = 0;
return this.result === 0
? 0
: this.emitNotTerminatedNamedEntity();
}
offset++;
this.excess++;
this.runConsumed++;
}
this.runConsumed = 0;
this.treeIndex += 1 + (runLength >> 1);
current = decodeTree[this.treeIndex];
valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
}
if (offset >= input.length)
break;
const char = input.charCodeAt(offset);
/*
* Implicit semicolon handling for nodes that require a semicolon but
* don't have an explicit ';' branch stored in the trie. If we have
* a value on the current node, it requires a semicolon, and the
* current input character is a semicolon, emit the entity using the
* current node (without descending further).
*/
if (char === CharCodes.SEMI &&
valueLength !== 0 &&
(current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) {
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
}
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 & bin_trie_flags_js_1.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 &&
(current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) === 0) {
this.result = this.treeIndex;
this.consumed += this.excess;
this.excess = 0;
}
}
// Increment offset & excess for next iteration
offset++;
this.excess++;
}
return -1;
}
/**
* Emit a named entity that was not terminated with a semicolon.
*
* @returns The number of characters consumed.
*/
emitNotTerminatedNamedEntity() {
var _a;
const { result, decodeTree } = this;
const valueLength = (decodeTree[result] & bin_trie_flags_js_1.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.
*/
emitNamedEntityData(result, valueLength, consumed) {
const { decodeTree } = this;
this.emitCodePoint(valueLength === 1
? decodeTree[result] &
~(bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH | bin_trie_flags_js_1.BinTrieFlags.FLAG13)
: 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.
*/
end() {
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;
}
}
}
}
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) {
let returnValue = "";
const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += (0, decode_codepoint_js_1.fromCodePoint)(data)));
return function decodeWithTrie(input, decodeMode) {
let lastIndex = 0;
let offset = 0;
while ((offset = input.indexOf("&", offset)) >= 0) {
returnValue += input.slice(lastIndex, offset);
decoder.startEntity(decodeMode);
const length = decoder.write(input,
// Skip the "&"
offset + 1);
if (length < 0) {
lastIndex = offset + decoder.end();
break;
}
lastIndex = offset + length;
// If `length` is 0, skip the current `&` and continue.
offset = length === 0 ? lastIndex + 1 : lastIndex;
}
const result = returnValue + input.slice(lastIndex);
// Make sure we don't keep a reference to the final string.
returnValue = "";
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, nodeIndex, char) {
const branchCount = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7;
const jumpOffset = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE;
// Case 1: Single branch encoded in jump offset
if (branchCount === 0) {
return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
}
// Case 2: Multiple branches encoded in jump table
if (jumpOffset) {
const value = char - jumpOffset;
return value < 0 || value >= branchCount
? -1
: decodeTree[nodeIndex + value] - 1;
}
// Case 3: Multiple branches encoded in packed dictionary (two keys per uint16)
const packedKeySlots = (branchCount + 1) >> 1;
/*
* Treat packed keys as a virtual sorted array of length `branchCount`.
* Key(i) = low byte for even i, high byte for odd i in slot i>>1.
*/
let lo = 0;
let hi = branchCount - 1;
while (lo <= hi) {
const mid = (lo + hi) >>> 1;
const slot = mid >> 1;
const packed = decodeTree[nodeIndex + slot];
const midKey = (packed >> ((mid & 1) * 8)) & 0xff;
if (midKey < char) {
lo = mid + 1;
}
else if (midKey > char) {
hi = mid - 1;
}
else {
return decodeTree[nodeIndex + packedKeySlots + mid];
}
}
return -1;
}
const htmlDecoder = /* #__PURE__ */ getDecoder(decode_data_html_js_1.htmlDecodeTree);
const xmlDecoder = /* #__PURE__ */ getDecoder(decode_data_xml_js_1.xmlDecodeTree);
/**
* Decodes an HTML string.
*
* @param htmlString The string to decode.
* @param mode The decoding mode.
* @returns The decoded string.
*/
function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
return htmlDecoder(htmlString, mode);
}
/**
* Decodes an HTML string in an attribute.
*
* @param htmlAttribute The string to decode.
* @returns The decoded string.
*/
function decodeHTMLAttribute(htmlAttribute) {
return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
}
/**
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
*
* @param htmlString The string to decode.
* @returns The decoded string.
*/
function decodeHTMLStrict(htmlString) {
return htmlDecoder(htmlString, DecodingMode.Strict);
}
/**
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
*
* @param xmlString The string to decode.
* @returns The decoded string.
*/
function decodeXML(xmlString) {
return xmlDecoder(xmlString, DecodingMode.Strict);
}
var decode_codepoint_js_2 = require("./decode-codepoint.js");
Object.defineProperty(exports, "decodeCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.decodeCodePoint; } });
Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.fromCodePoint; } });
Object.defineProperty(exports, "replaceCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.replaceCodePoint; } });
// Re-export for use by eg. htmlparser2
var decode_data_html_js_2 = require("./generated/decode-data-html.js");
Object.defineProperty(exports, "htmlDecodeTree", { enumerable: true, get: function () { return decode_data_html_js_2.htmlDecodeTree; } });
var decode_data_xml_js_2 = require("./generated/decode-data-xml.js");
Object.defineProperty(exports, "xmlDecodeTree", { enumerable: true, get: function () { return decode_data_xml_js_2.xmlDecodeTree; } });
//# sourceMappingURL=decode.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
"use strict";
// Generated using scripts/write-decode-map.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.xmlDecodeTree = void 0;
const decode_shared_js_1 = require("../internal/decode-shared.js");
exports.xmlDecodeTree = (0, decode_shared_js_1.decodeBase64)("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");
//# sourceMappingURL=decode-data-xml.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BinTrieFlags = void 0;
/**
* Bit flags & masks for the binary trie encoding used for entity decoding.
*
* Bit layout (16 bits total):
* 15..14 VALUE_LENGTH (+1 encoding; 0 => no value)
* 13 FLAG13. If valueLength>0: semicolon required flag (implicit ';').
* If valueLength==0: compact run flag.
* 12..7 BRANCH_LENGTH Branch length (0 => single branch in 6..0 if jumpOffset==char) OR run length (when compact run)
* 6..0 JUMP_TABLE Jump offset (jump table) OR single-branch char code OR first run char
*/
var BinTrieFlags;
(function (BinTrieFlags) {
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
})(BinTrieFlags || (exports.BinTrieFlags = BinTrieFlags = {}));
//# sourceMappingURL=bin-trie-flags.js.map

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeBase64 = decodeBase64;
/*
* Shared base64 decode helper for generated decode data.
* Assumes global atob is available.
*/
function decodeBase64(input) {
const binary =
// eslint-disable-next-line n/no-unsupported-features/node-builtins
typeof atob === "function"
? // Browser (and Node >=16)
// eslint-disable-next-line n/no-unsupported-features/node-builtins
atob(input)
: // Older Node versions (<16)
// eslint-disable-next-line n/no-unsupported-features/node-builtins
typeof Buffer.from === "function"
? // eslint-disable-next-line n/no-unsupported-features/node-builtins
Buffer.from(input, "base64").toString("binary")
: // eslint-disable-next-line unicorn/no-new-buffer, n/no-deprecated-api
new Buffer(input, "base64").toString("binary");
const evenLength = binary.length & ~1; // Round down to even length
const out = new Uint16Array(evenLength / 2);
for (let index = 0, outIndex = 0; index < evenLength; index += 2) {
const lo = binary.charCodeAt(index);
const hi = binary.charCodeAt(index + 1);
out[outIndex++] = lo | (hi << 8);
}
return out;
}
//# sourceMappingURL=decode-shared.js.map

View File

@@ -0,0 +1,3 @@
{
"type": "commonjs"
}

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

@@ -0,0 +1,120 @@
{
"name": "entities",
"version": "7.0.1",
"description": "Encode & decode XML and HTML entities with ease & speed",
"keywords": [
"html entities",
"entity decoder",
"entity encoding",
"html decoding",
"html encoding",
"xml decoding",
"xml encoding"
],
"repository": {
"type": "git",
"url": "https://github.com/fb55/entities.git"
},
"funding": "https://github.com/fb55/entities?sponsor=1",
"license": "BSD-2-Clause",
"author": "Felix Boehm <me@feedic.com>",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./decode": {
"import": {
"types": "./dist/esm/decode.d.ts",
"default": "./dist/esm/decode.js"
},
"require": {
"types": "./dist/commonjs/decode.d.ts",
"default": "./dist/commonjs/decode.js"
}
},
"./escape": {
"import": {
"types": "./dist/esm/escape.d.ts",
"default": "./dist/esm/escape.js"
},
"require": {
"types": "./dist/commonjs/escape.d.ts",
"default": "./dist/commonjs/escape.js"
}
}
},
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"files": [
"decode.js",
"decode.d.ts",
"escape.js",
"escape.d.ts",
"dist",
"src",
"!**/*.spec.ts"
],
"scripts": {
"build:docs": "typedoc --hideGenerator src/index.ts",
"build:encode-trie": "node --import=tsx scripts/write-encode-map.ts",
"build:trie": "node --import=tsx scripts/write-decode-map.ts",
"benchmark": "node --import=tsx scripts/benchmark.ts",
"format": "npm run format:es && npm run format:biome",
"format:es": "npm run lint:es -- --fix",
"format:biome": "biome check --fix .",
"lint": "npm run lint:es && npm run lint:ts && npm run lint:biome",
"lint:es": "eslint . --ignore-path .gitignore",
"lint:biome": "biome check .",
"lint:ts": "tsc --noEmit",
"prepublishOnly": "tshy",
"test": "npm run test:vi && npm run lint",
"test:vi": "vitest run"
},
"devDependencies": {
"@biomejs/biome": "^2.3.11",
"@types/node": "^25.0.9",
"@typescript-eslint/eslint-plugin": "^8.53.1",
"@typescript-eslint/parser": "^8.53.1",
"@vitest/coverage-v8": "^3.2.4",
"@types/he": "^1.2.3",
"eslint": "^8.57.1",
"eslint-config-biome": "^2.1.3",
"eslint-plugin-n": "^17.23.2",
"eslint-plugin-unicorn": "^56.0.1",
"he": "^1.2.0",
"html-entities": "^2.6.0",
"parse-entities": "^4.0.2",
"tinybench": "^5.1.0",
"tshy": "^3.1.0",
"tsx": "^4.21.0",
"typedoc": "^0.28.16",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
},
"engines": {
"node": ">=0.12"
},
"tshy": {
"exclude": [
"**/*.spec.ts",
"**/__fixtures__/*",
"**/__tests__/*",
"**/__snapshots__/*"
],
"exports": {
".": "./src/index.ts",
"./decode": "./src/decode.ts",
"./escape": "./src/escape.ts"
}
}
}

View File

@@ -0,0 +1,344 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.estreeWalker = {}));
}(this, (function (exports) { 'use strict';
// @ts-check
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef {{
skip: () => void;
remove: () => void;
replace: (node: BaseNode) => void;
}} WalkerContext */
class WalkerBase {
constructor() {
/** @type {boolean} */
this.should_skip = false;
/** @type {boolean} */
this.should_remove = false;
/** @type {BaseNode | null} */
this.replacement = null;
/** @type {WalkerContext} */
this.context = {
skip: () => (this.should_skip = true),
remove: () => (this.should_remove = true),
replace: (node) => (this.replacement = node)
};
}
/**
*
* @param {any} parent
* @param {string} prop
* @param {number} index
* @param {BaseNode} node
*/
replace(parent, prop, index, node) {
if (parent) {
if (index !== null) {
parent[prop][index] = node;
} else {
parent[prop] = node;
}
}
}
/**
*
* @param {any} parent
* @param {string} prop
* @param {number} index
*/
remove(parent, prop, index) {
if (parent) {
if (index !== null) {
parent[prop].splice(index, 1);
} else {
delete parent[prop];
}
}
}
}
// @ts-check
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
/** @typedef {(
* this: WalkerContext,
* node: BaseNode,
* parent: BaseNode,
* key: string,
* index: number
* ) => void} SyncHandler */
class SyncWalker extends WalkerBase {
/**
*
* @param {SyncHandler} enter
* @param {SyncHandler} leave
*/
constructor(enter, leave) {
super();
/** @type {SyncHandler} */
this.enter = enter;
/** @type {SyncHandler} */
this.leave = leave;
}
/**
*
* @param {BaseNode} node
* @param {BaseNode} parent
* @param {string} [prop]
* @param {number} [index]
* @returns {BaseNode}
*/
visit(node, parent, prop, index) {
if (node) {
if (this.enter) {
const _should_skip = this.should_skip;
const _should_remove = this.should_remove;
const _replacement = this.replacement;
this.should_skip = false;
this.should_remove = false;
this.replacement = null;
this.enter.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const skipped = this.should_skip;
const removed = this.should_remove;
this.should_skip = _should_skip;
this.should_remove = _should_remove;
this.replacement = _replacement;
if (skipped) return node;
if (removed) return null;
}
for (const key in node) {
const value = node[key];
if (typeof value !== "object") {
continue;
} else if (Array.isArray(value)) {
for (let i = 0; i < value.length; i += 1) {
if (value[i] !== null && typeof value[i].type === 'string') {
if (!this.visit(value[i], node, key, i)) {
// removed
i--;
}
}
}
} else if (value !== null && typeof value.type === "string") {
this.visit(value, node, key, null);
}
}
if (this.leave) {
const _replacement = this.replacement;
const _should_remove = this.should_remove;
this.replacement = null;
this.should_remove = false;
this.leave.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const removed = this.should_remove;
this.replacement = _replacement;
this.should_remove = _should_remove;
if (removed) return null;
}
}
return node;
}
}
// @ts-check
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./walker').WalkerContext} WalkerContext */
/** @typedef {(
* this: WalkerContext,
* node: BaseNode,
* parent: BaseNode,
* key: string,
* index: number
* ) => Promise<void>} AsyncHandler */
class AsyncWalker extends WalkerBase {
/**
*
* @param {AsyncHandler} enter
* @param {AsyncHandler} leave
*/
constructor(enter, leave) {
super();
/** @type {AsyncHandler} */
this.enter = enter;
/** @type {AsyncHandler} */
this.leave = leave;
}
/**
*
* @param {BaseNode} node
* @param {BaseNode} parent
* @param {string} [prop]
* @param {number} [index]
* @returns {Promise<BaseNode>}
*/
async visit(node, parent, prop, index) {
if (node) {
if (this.enter) {
const _should_skip = this.should_skip;
const _should_remove = this.should_remove;
const _replacement = this.replacement;
this.should_skip = false;
this.should_remove = false;
this.replacement = null;
await this.enter.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const skipped = this.should_skip;
const removed = this.should_remove;
this.should_skip = _should_skip;
this.should_remove = _should_remove;
this.replacement = _replacement;
if (skipped) return node;
if (removed) return null;
}
for (const key in node) {
const value = node[key];
if (typeof value !== "object") {
continue;
} else if (Array.isArray(value)) {
for (let i = 0; i < value.length; i += 1) {
if (value[i] !== null && typeof value[i].type === 'string') {
if (!(await this.visit(value[i], node, key, i))) {
// removed
i--;
}
}
}
} else if (value !== null && typeof value.type === "string") {
await this.visit(value, node, key, null);
}
}
if (this.leave) {
const _replacement = this.replacement;
const _should_remove = this.should_remove;
this.replacement = null;
this.should_remove = false;
await this.leave.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const removed = this.should_remove;
this.replacement = _replacement;
this.should_remove = _should_remove;
if (removed) return null;
}
}
return node;
}
}
// @ts-check
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: SyncHandler
* leave?: SyncHandler
* }} walker
* @returns {BaseNode}
*/
function walk(ast, { enter, leave }) {
const instance = new SyncWalker(enter, leave);
return instance.visit(ast, null);
}
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: AsyncHandler
* leave?: AsyncHandler
* }} walker
* @returns {Promise<BaseNode>}
*/
async function asyncWalk(ast, { enter, leave }) {
const instance = new AsyncWalker(enter, leave);
return await instance.visit(ast, null);
}
exports.asyncWalk = asyncWalk;
exports.walk = walk;
Object.defineProperty(exports, '__esModule', { value: true });
})));

37
.output/server/node_modules/estree-walker/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "estree-walker",
"description": "Traverse an ESTree-compliant AST",
"version": "2.0.2",
"private": false,
"author": "Rich Harris",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Rich-Harris/estree-walker"
},
"type": "commonjs",
"main": "./dist/umd/estree-walker.js",
"module": "./dist/esm/estree-walker.js",
"exports": {
"require": "./dist/umd/estree-walker.js",
"import": "./dist/esm/estree-walker.js"
},
"types": "types/index.d.ts",
"scripts": {
"prepublishOnly": "npm run build && npm test",
"build": "tsc && rollup -c",
"test": "uvu test"
},
"devDependencies": {
"@types/estree": "0.0.42",
"rollup": "^2.10.9",
"typescript": "^3.7.5",
"uvu": "^0.5.1"
},
"files": [
"src",
"dist",
"types",
"README.md"
]
}

266
.output/server/node_modules/hookable/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,266 @@
//#region src/utils.ts
function flatHooks(configHooks, hooks = {}, parentName) {
for (const key in configHooks) {
const subHook = configHooks[key];
const name = parentName ? `${parentName}:${key}` : key;
if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
else if (typeof subHook === "function") hooks[name] = subHook;
}
return hooks;
}
function mergeHooks(...hooks) {
const finalHooks = {};
for (const hook of hooks) {
const flatenHook = flatHooks(hook);
for (const key in flatenHook) if (finalHooks[key]) finalHooks[key].push(flatenHook[key]);
else finalHooks[key] = [flatenHook[key]];
}
for (const key in finalHooks) if (finalHooks[key].length > 1) {
const array = finalHooks[key];
finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
} else finalHooks[key] = finalHooks[key][0];
return finalHooks;
}
function serial(tasks, function_) {
return tasks.reduce((promise, task) => promise.then(() => function_(task)), Promise.resolve());
}
const createTask = /* @__PURE__ */ (() => {
if (console.createTask) return console.createTask;
const defaultTask = { run: (fn) => fn() };
return () => defaultTask;
})();
function callHooks(hooks, args, startIndex, task) {
for (let i = startIndex; i < hooks.length; i += 1) try {
const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
if (result instanceof Promise) return result.then(() => callHooks(hooks, args, i + 1, task));
} catch (error) {
return Promise.reject(error);
}
}
function serialTaskCaller(hooks, args, name) {
if (hooks.length > 0) return callHooks(hooks, args, 0, createTask(name));
}
function parallelTaskCaller(hooks, args, name) {
if (hooks.length > 0) {
const task = createTask(name);
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
}
}
/** @deprecated */
function serialCaller(hooks, arguments_) {
return hooks.reduce((promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])), Promise.resolve());
}
/** @deprecated */
function parallelCaller(hooks, args) {
return Promise.all(hooks.map((hook) => hook(...args || [])));
}
function callEachWith(callbacks, arg0) {
for (const callback of [...callbacks]) callback(arg0);
}
//#endregion
//#region src/hookable.ts
var Hookable = class {
_hooks;
_before;
_after;
_deprecatedHooks;
_deprecatedMessages;
constructor() {
this._hooks = {};
this._before = void 0;
this._after = void 0;
this._deprecatedMessages = void 0;
this._deprecatedHooks = {};
this.hook = this.hook.bind(this);
this.callHook = this.callHook.bind(this);
this.callHookWith = this.callHookWith.bind(this);
}
hook(name, function_, options = {}) {
if (!name || typeof function_ !== "function") return () => {};
const originalName = name;
let dep;
while (this._deprecatedHooks[name]) {
dep = this._deprecatedHooks[name];
name = dep.to;
}
if (dep && !options.allowDeprecated) {
let message = dep.message;
if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
if (!this._deprecatedMessages.has(message)) {
console.warn(message);
this._deprecatedMessages.add(message);
}
}
if (!function_.name) try {
Object.defineProperty(function_, "name", {
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
configurable: true
});
} catch {}
this._hooks[name] = this._hooks[name] || [];
this._hooks[name].push(function_);
return () => {
if (function_) {
this.removeHook(name, function_);
function_ = void 0;
}
};
}
hookOnce(name, function_) {
let _unreg;
let _function = (...arguments_) => {
if (typeof _unreg === "function") _unreg();
_unreg = void 0;
_function = void 0;
return function_(...arguments_);
};
_unreg = this.hook(name, _function);
return _unreg;
}
removeHook(name, function_) {
const hooks = this._hooks[name];
if (hooks) {
const index = hooks.indexOf(function_);
if (index !== -1) hooks.splice(index, 1);
if (hooks.length === 0) this._hooks[name] = void 0;
}
}
deprecateHook(name, deprecated) {
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
const _hooks = this._hooks[name] || [];
this._hooks[name] = void 0;
for (const hook of _hooks) this.hook(name, hook);
}
deprecateHooks(deprecatedHooks) {
for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
}
addHooks(configHooks) {
const hooks = flatHooks(configHooks);
const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
return () => {
for (const unreg of removeFns) unreg();
removeFns.length = 0;
};
}
removeHooks(configHooks) {
const hooks = flatHooks(configHooks);
for (const key in hooks) this.removeHook(key, hooks[key]);
}
removeAllHooks() {
this._hooks = {};
}
callHook(name, ...args) {
return this.callHookWith(serialTaskCaller, name, args);
}
callHookParallel(name, ...args) {
return this.callHookWith(parallelTaskCaller, name, args);
}
callHookWith(caller, name, args) {
const event = this._before || this._after ? {
name,
args,
context: {}
} : void 0;
if (this._before) callEachWith(this._before, event);
const result = caller(this._hooks[name] ? [...this._hooks[name]] : [], args, name);
if (result instanceof Promise) return result.finally(() => {
if (this._after && event) callEachWith(this._after, event);
});
if (this._after && event) callEachWith(this._after, event);
return result;
}
beforeEach(function_) {
this._before = this._before || [];
this._before.push(function_);
return () => {
if (this._before !== void 0) {
const index = this._before.indexOf(function_);
if (index !== -1) this._before.splice(index, 1);
}
};
}
afterEach(function_) {
this._after = this._after || [];
this._after.push(function_);
return () => {
if (this._after !== void 0) {
const index = this._after.indexOf(function_);
if (index !== -1) this._after.splice(index, 1);
}
};
}
};
function createHooks() {
return new Hookable();
}
var HookableCore = class {
_hooks;
constructor() {
this._hooks = {};
}
hook(name, fn) {
if (!name || typeof fn !== "function") return () => {};
this._hooks[name] = this._hooks[name] || [];
this._hooks[name].push(fn);
return () => {
if (fn) {
this.removeHook(name, fn);
fn = void 0;
}
};
}
removeHook(name, function_) {
const hooks = this._hooks[name];
if (hooks) {
const index = hooks.indexOf(function_);
if (index !== -1) hooks.splice(index, 1);
if (hooks.length === 0) this._hooks[name] = void 0;
}
}
callHook(name, ...args) {
const hooks = this._hooks[name];
if (!hooks || hooks.length === 0) return;
return callHooks(hooks, args, 0);
}
};
//#endregion
//#region src/debugger.ts
const isBrowser = typeof window !== "undefined";
/** Start debugging hook names and timing in console */
function createDebugger(hooks, _options = {}) {
const options = {
inspect: isBrowser,
group: isBrowser,
filter: () => true,
..._options
};
const _filter = options.filter;
const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
const _tag = options.tag ? `[${options.tag}] ` : "";
const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
const _idCtr = {};
const unsubscribeBefore = hooks.beforeEach((event) => {
if (filter !== void 0 && !filter(event.name)) return;
_idCtr[event.name] = _idCtr[event.name] || 0;
event._id = _idCtr[event.name]++;
console.time(logPrefix(event));
});
const unsubscribeAfter = hooks.afterEach((event) => {
if (filter !== void 0 && !filter(event.name)) return;
if (options.group) console.groupCollapsed(event.name);
if (options.inspect) console.timeLog(logPrefix(event), event.args);
else console.timeEnd(logPrefix(event));
if (options.group) console.groupEnd();
_idCtr[event.name]--;
});
return { close: () => {
unsubscribeBefore();
unsubscribeAfter();
} };
}
//#endregion
export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };

52
.output/server/node_modules/hookable/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"name": "hookable",
"version": "6.0.1",
"description": "Awaitable hook system",
"keywords": [
"hook",
"hookable",
"plugin",
"tapable",
"tappable"
],
"repository": "unjs/hookable",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": "./dist/index.mjs"
},
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"files": [
"dist"
],
"scripts": {
"bench": "node --expose-gc --allow-natives-syntax test/bench.ts",
"build": "obuild src/index.ts",
"dev": "vitest",
"lint": "eslint --cache . && prettier -c src test",
"lint:fix": "eslint --cache . --fix && prettier -c src test -w",
"prepublish": "pnpm build",
"release": "pnpm test && pnpm build && changelogen --release --publish --push",
"test": "pnpm lint && vitest run --coverage",
"test:types": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "^25.0.3",
"@vitest/coverage-v8": "^4.0.16",
"changelogen": "^0.6.2",
"esbuild": "^0.27.2",
"eslint": "^9.39.2",
"eslint-config-unjs": "^0.5.0",
"expect-type": "^1.3.0",
"hookable-prev": "npm:hookable@^5.5.3",
"mitata": "^1.0.34",
"obuild": "^0.4.9",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"packageManager": "pnpm@10.26.0"
}

View File

@@ -0,0 +1,121 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = require('./util');
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? new Map() : Object.create(null);
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
/**
* Return how many unique items are in this ArraySet. If duplicates have been
* added, than those do not count towards the size.
*
* @returns Number
*/
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util.toSetString(aStr);
return has.call(this._set, sStr);
}
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;

View File

@@ -0,0 +1,140 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var base64 = require('./base64');
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string via the out parameter.
*/
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};

View File

@@ -0,0 +1,67 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52;
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return (charCode - bigA);
}
// 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return (charCode - littleA + littleOffset);
}
// 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return (charCode - zero + numberOffset);
}
// 62: +
if (charCode == plus) {
return 62;
}
// 63: /
if (charCode == slash) {
return 63;
}
// Invalid base64 digit.
return -1;
};

View File

@@ -0,0 +1,111 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.GREATEST_LOWER_BOUND = 1;
exports.LEAST_UPPER_BOUND = 2;
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-closest element.
//
// 3. We did not find the exact element, and there is no next-closest
// element than the one we are searching for, so we return -1.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
// Found the element we are looking for.
return mid;
}
else if (cmp > 0) {
// Our needle is greater than aHaystack[mid].
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
}
// The exact needle element was not found in this haystack. Determine if
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}
}
else {
// Our needle is less than aHaystack[mid].
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
}
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return mid;
} else {
return aLow < 0 ? -1 : aLow;
}
}
}
/**
* This is an implementation of binary search which will always try and return
* the index of the closest element if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
*/
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
if (index < 0) {
return -1;
}
// We have found either the exact element, or the next-closest element than
// the one we are searching for. However, there may be more than one such
// element. Make sure we always return the smallest of these.
while (index - 1 >= 0) {
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
break;
}
--index;
}
return index;
};

View File

@@ -0,0 +1,79 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2014 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = require('./util');
/**
* Determine whether mappingB is after mappingA with respect to generated
* position.
*/
function generatedPositionAfter(mappingA, mappingB) {
// Optimized for most common case
var lineA = mappingA.generatedLine;
var lineB = mappingB.generatedLine;
var columnA = mappingA.generatedColumn;
var columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA ||
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
/**
* A data structure to provide a sorted view of accumulated mappings in a
* performance conscious manner. It trades a neglibable overhead in general
* case for a large speedup in case of mappings being added in order.
*/
function MappingList() {
this._array = [];
this._sorted = true;
// Serves as infimum
this._last = {generatedLine: -1, generatedColumn: 0};
}
/**
* Iterate through internal items. This method takes the same arguments that
* `Array.prototype.forEach` takes.
*
* NOTE: The order of the mappings is NOT guaranteed.
*/
MappingList.prototype.unsortedForEach =
function MappingList_forEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
};
/**
* Add the given source mapping.
*
* @param Object aMapping
*/
MappingList.prototype.add = function MappingList_add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
};
/**
* Returns the flat, sorted array of mappings. The mappings are sorted by
* generated position.
*
* WARNING: This method returns internal data without copying, for
* performance. The return value must NOT be mutated, and should be treated as
* an immutable borrow. If you want to take ownership, you must make your own
* copy.
*/
MappingList.prototype.toArray = function MappingList_toArray() {
if (!this._sorted) {
this._array.sort(util.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
};
exports.MappingList = MappingList;

View File

@@ -0,0 +1,132 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
// custom comparator function, calling back and forth between the VM's C++ and
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
// worse generated code for the comparator function than would be optimal. In
// fact, when sorting with a comparator, these costs outweigh the benefits of
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
// a ~3500ms mean speed-up in `bench/bench.html`.
function SortTemplate(comparator) {
/**
* Swap the elements indexed by `x` and `y` in the array `ary`.
*
* @param {Array} ary
* The array.
* @param {Number} x
* The index of the first item.
* @param {Number} y
* The index of the second item.
*/
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
/**
* Returns a random integer within the range `low .. high` inclusive.
*
* @param {Number} low
* The lower bound on the range.
* @param {Number} high
* The upper bound on the range.
*/
function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
}
/**
* The Quick Sort algorithm.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
* @param {Number} p
* Start index of the array
* @param {Number} r
* End index of the array
*/
function doQuickSort(ary, comparator, p, r) {
// If our lower bound is less than our upper bound, we (1) partition the
// array into two pieces and (2) recurse on each half. If it is not, this is
// the empty array and our base case.
if (p < r) {
// (1) Partitioning.
//
// The partitioning chooses a pivot between `p` and `r` and moves all
// elements that are less than or equal to the pivot to the before it, and
// all the elements that are greater than it after it. The effect is that
// once partition is done, the pivot is in the exact place it will be when
// the array is put in sorted order, and it will not need to be moved
// again. This runs in O(n) time.
// Always choose a random pivot so that an input array which is reverse
// sorted does not cause O(n^2) running time.
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r];
// Immediately after `j` is incremented in this loop, the following hold
// true:
//
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
//
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot, false) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1;
// (2) Recurse on each half.
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
return doQuickSort;
}
function cloneSort(comparator) {
let template = SortTemplate.toString();
let templateFn = new Function(`return ${template}`)();
return templateFn(comparator);
}
/**
* Sort the given array in-place with the given comparator function.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
*/
let sortCache = new WeakMap();
exports.quickSort = function (ary, comparator, start = 0) {
let doQuickSort = sortCache.get(comparator);
if (doQuickSort === void 0) {
doQuickSort = cloneSort(comparator);
sortCache.set(comparator, doQuickSort);
}
doQuickSort(ary, comparator, start, ary.length - 1);
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,444 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var base64VLQ = require('./base64-vlq');
var util = require('./util');
var ArraySet = require('./array-set').ArraySet;
var MappingList = require('./mapping-list').MappingList;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. You may pass an object with the following
* properties:
*
* - file: The filename of the generated source.
* - sourceRoot: A root for all relative URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, {
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
}));
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping =
function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
if (!this._skipValidation) {
if (this._validateMapping(generated, original, source, name) === false) {
return;
}
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent =
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile;
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
'or the source map\'s "file" property. Both were omitted.'
);
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
// Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet();
// Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function (mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source)
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile = util.join(aSourceMapPath, sourceFile);
}
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +
'the original mapping entirely and only map the generated position. If so, pass ' +
'null for the original mapping instead of an object with empty or null values.'
if (this._ignoreInvalidMapping) {
if (typeof console !== 'undefined' && console.warn) {
console.warn(message);
}
return false;
} else {
throw new Error(message);
}
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
return;
}
else {
var message = 'Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
});
if (this._ignoreInvalidMapping) {
if (typeof console !== 'undefined' && console.warn) {
console.warn(message);
}
return false;
} else {
throw new Error(message)
}
}
};
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings =
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = ''
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
}
else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
// lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent =
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function (source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
var key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
? this._sourcesContents[key]
: null;
}, this);
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports.SourceMapGenerator = SourceMapGenerator;

View File

@@ -0,0 +1,413 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
var util = require('./util');
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
// operating systems these days (capturing the result).
var REGEX_NEWLINE = /(\r?\n)/;
// Newline character code for charCodeAt() comparisons
var NEWLINE_CODE = 10;
// Private symbol for identifying `SourceNode`s when multiple versions of
// the source-map library are loaded. This MUST NOT CHANGE across
// versions!
var isSourceNode = "$$$isSourceNode$$$";
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
* @param aRelativePath Optional. The path that relative sources in the
* SourceMapConsumer should be relative to.
*/
SourceNode.fromStringWithSourceMap =
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode();
// All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are accessed by calling `shiftNextLine`.
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
var remainingLinesIndex = 0;
var shiftNextLine = function() {
var lineContents = getNextLine();
// The last line of a file might not have a newline.
var newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ?
remainingLines[remainingLinesIndex++] : undefined;
}
};
// We need to remember the position of "remainingLines"
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping !== null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
// Associate first line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0;
// The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[remainingLinesIndex] || '';
var code = nextLine.substr(0, mapping.generatedColumn -
lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
// No more remaining code, continue
lastMapping = mapping;
return;
}
}
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[remainingLinesIndex] || '';
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this);
// We have processed all mappings.
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
}
// and add the remaining lines without any mapping
node.add(remainingLines.splice(remainingLinesIndex).join(""));
}
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === undefined) {
node.add(code);
} else {
var source = aRelativePath
? util.join(aRelativePath, mapping.source)
: mapping.source;
node.add(new SourceNode(mapping.originalLine,
mapping.originalColumn,
source,
code,
mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length-1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
}
else {
if (chunk !== '') {
aFn(chunk, { source: this.source,
line: this.line,
column: this.column,
name: this.name });
}
}
}
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len-1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
}
else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
}
else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent =
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents =
function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null
&& original.line !== null
&& original.column !== null) {
if(lastOriginalSource !== original.source
|| lastOriginalLine !== original.line
|| lastOriginalColumn !== original.column
|| lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (var idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0;
// Mappings end at eol
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map };
};
exports.SourceNode = SourceNode;

594
.output/server/node_modules/source-map-js/lib/util.js generated vendored Normal file
View File

@@ -0,0 +1,594 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = '';
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ':';
}
url += '//';
if (aParsedUrl.auth) {
url += aParsedUrl.auth + '@';
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
var MAX_CACHED_INPUTS = 32;
/**
* Takes some function `f(input) -> result` and returns a memoized version of
* `f`.
*
* We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
* memoization is a dumb-simple, linear least-recently-used cache.
*/
function lruMemoize(f) {
var cache = [];
return function(input) {
for (var i = 0; i < cache.length; i++) {
if (cache[i].input === input) {
var temp = cache[0];
cache[0] = cache[i];
cache[i] = temp;
return cache[0].result;
}
}
var result = f(input);
cache.unshift({
input,
result,
});
if (cache.length > MAX_CACHED_INPUTS) {
cache.pop();
}
return result;
};
}
/**
* Normalizes a path, or the path portion of a URL:
*
* - Replaces consecutive slashes with one slash.
* - Removes unnecessary '.' parts.
* - Removes unnecessary '<dir>/..' parts.
*
* Based on code in the Node.js 'path' core module.
*
* @param aPath The path or url to normalize.
*/
var normalize = lruMemoize(function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path);
// Split the path into parts between `/` characters. This is much faster than
// using `.split(/\/+/g)`.
var parts = [];
var start = 0;
var i = 0;
while (true) {
start = i;
i = path.indexOf("/", start);
if (i === -1) {
parts.push(path.slice(start));
break;
} else {
parts.push(path.slice(start, i));
while (i < path.length && path[i] === "/") {
i++;
}
}
}
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
});
exports.normalize = normalize;
/**
* Joins two paths/URLs.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be joined with the root.
*
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
* first.
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
* is updated with the result and aRoot is returned. Otherwise the result
* is returned.
* - If aPath is absolute, the result is aPath.
* - Otherwise the two paths are joined with a slash.
* - Joining for example 'http://' and 'www.example.com' is also supported.
*/
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
}
// `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
// `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/'
? aPath
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports.join = join;
exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
};
/**
* Make a path relative to a URL or another path.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be made relative to aRoot.
*/
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from the root one by one, until either we find
// a prefix that fits, or we run out of components to remove.
var level = 0;
while (aPath.indexOf(aRoot + '/') !== 0) {
var index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
}
// If the only part of the root that is left is the scheme (i.e. http://,
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
// have exhausted all components, so the path is not relative to the root.
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
// Make sure we add a "../" for each component we removed from the root.
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports.relative = relative;
var supportsNullProto = (function () {
var obj = Object.create(null);
return !('__proto__' in obj);
}());
function identity (s) {
return s;
}
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
if (isProtoString(aStr)) {
return '$' + aStr;
}
return aStr;
}
exports.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
var length = s.length;
if (length < 9 /* "__proto__".length */) {
return false;
}
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
return false;
}
for (var i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36 /* '$' */) {
return false;
}
}
return true;
}
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByOriginalPositions = compareByOriginalPositions;
function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
var cmp
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
/**
* Comparator between two mappings with deflated source and name indices where
* the generated positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 === null) {
return 1; // aStr2 !== null
}
if (aStr2 === null) {
return -1; // aStr1 !== null
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
/**
* Comparator between two mappings with inflated source and name strings where
* the generated positions are compared.
*/
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
/**
* Strip any JSON XSSI avoidance prefix from the string (as documented
* in the source maps specification), and then parse the string as
* JSON.
*/
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
}
exports.parseSourceMapInput = parseSourceMapInput;
/**
* Compute the URL of a source given the the source root, the source's
* URL, and the source map's URL.
*/
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
sourceURL = sourceURL || '';
if (sourceRoot) {
// This follows what Chrome does.
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
sourceRoot += '/';
}
// The spec says:
// Line 4: An optional source root, useful for relocating source
// files on a server or removing repeated values in the
// “sources” entry. This value is prepended to the individual
// entries in the “source” field.
sourceURL = sourceRoot + sourceURL;
}
// Historically, SourceMapConsumer did not take the sourceMapURL as
// a parameter. This mode is still somewhat supported, which is why
// this code block is conditional. However, it's preferable to pass
// the source map URL to SourceMapConsumer, so that this function
// can implement the source URL resolution algorithm as outlined in
// the spec. This block is basically the equivalent of:
// new URL(sourceURL, sourceMapURL).toString()
// ... except it avoids using URL, which wasn't available in the
// older releases of node still supported by this library.
//
// The spec says:
// If the sources are not absolute URLs after prepending of the
// “sourceRoot”, the sources are resolved relative to the
// SourceMap (like resolving script src in a html document).
if (sourceMapURL) {
var parsed = urlParse(sourceMapURL);
if (!parsed) {
throw new Error("sourceMapURL could not be parsed");
}
if (parsed.path) {
// Strip the last path component, but keep the "/".
var index = parsed.path.lastIndexOf('/');
if (index >= 0) {
parsed.path = parsed.path.substring(0, index + 1);
}
}
sourceURL = join(urlGenerate(parsed), sourceURL);
}
return normalize(sourceURL);
}
exports.computeSourceURL = computeSourceURL;

71
.output/server/node_modules/source-map-js/package.json generated vendored Normal file
View File

@@ -0,0 +1,71 @@
{
"name": "source-map-js",
"description": "Generates and consumes source maps",
"version": "1.2.1",
"homepage": "https://github.com/7rulnik/source-map-js",
"author": "Valentin 7rulnik Semirulnik <v7rulnik@gmail.com>",
"contributors": [
"Nick Fitzgerald <nfitzgerald@mozilla.com>",
"Tobias Koppers <tobias.koppers@googlemail.com>",
"Duncan Beevers <duncan@dweebd.com>",
"Stephen Crane <scrane@mozilla.com>",
"Ryan Seddon <seddon.ryan@gmail.com>",
"Miles Elam <miles.elam@deem.com>",
"Mihai Bazon <mihai.bazon@gmail.com>",
"Michael Ficarra <github.public.email@michael.ficarra.me>",
"Todd Wolfson <todd@twolfson.com>",
"Alexander Solovyov <alexander@solovyov.net>",
"Felix Gnass <fgnass@gmail.com>",
"Conrad Irwin <conrad.irwin@gmail.com>",
"usrbincc <usrbincc@yahoo.com>",
"David Glasser <glasser@davidglasser.net>",
"Chase Douglas <chase@newrelic.com>",
"Evan Wallace <evan.exe@gmail.com>",
"Heather Arthur <fayearthur@gmail.com>",
"Hugh Kennedy <hughskennedy@gmail.com>",
"David Glasser <glasser@davidglasser.net>",
"Simon Lydell <simon.lydell@gmail.com>",
"Jmeas Smith <jellyes2@gmail.com>",
"Michael Z Goddard <mzgoddard@gmail.com>",
"azu <azu@users.noreply.github.com>",
"John Gozde <john@gozde.ca>",
"Adam Kirkton <akirkton@truefitinnovation.com>",
"Chris Montgomery <christopher.montgomery@dowjones.com>",
"J. Ryan Stinnett <jryans@gmail.com>",
"Jack Herrington <jherrington@walmartlabs.com>",
"Chris Truter <jeffpalentine@gmail.com>",
"Daniel Espeset <daniel@danielespeset.com>",
"Jamie Wong <jamie.lf.wong@gmail.com>",
"Eddy Bruël <ejpbruel@mozilla.com>",
"Hawken Rives <hawkrives@gmail.com>",
"Gilad Peleg <giladp007@gmail.com>",
"djchie <djchie.dev@gmail.com>",
"Gary Ye <garysye@gmail.com>",
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
],
"repository": "7rulnik/source-map-js",
"main": "./source-map.js",
"files": [
"source-map.js",
"source-map.d.ts",
"lib/"
],
"engines": {
"node": ">=0.10.0"
},
"license": "BSD-3-Clause",
"scripts": {
"test": "npm run build && node test/run-tests.js",
"build": "webpack --color",
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
},
"devDependencies": {
"clean-publish": "^3.1.0",
"doctoc": "^0.15.0",
"webpack": "^1.12.0"
},
"clean-publish": {
"cleanDocs": true
},
"typings": "source-map.d.ts"
}

View File

@@ -0,0 +1,8 @@
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
exports.SourceNode = require('./lib/source-node').SourceNode;

645
.output/server/node_modules/ufo/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,645 @@
const n = /[^\0-\x7E]/;
const t = /[\x2E\u3002\uFF0E\uFF61]/g;
const o = {
overflow: "Overflow Error",
"not-basic": "Illegal Input",
"invalid-input": "Invalid Input"
};
const e = Math.floor;
const r = String.fromCharCode;
function s(n2) {
throw new RangeError(o[n2]);
}
const c = function(n2, t2) {
return n2 + 22 + 75 * (n2 < 26) - ((t2 != 0) << 5);
};
const u = function(n2, t2, o2) {
let r2 = 0;
for (n2 = o2 ? e(n2 / 700) : n2 >> 1, n2 += e(n2 / t2); n2 > 455; r2 += 36) {
n2 = e(n2 / 35);
}
return e(r2 + 36 * n2 / (n2 + 38));
};
function toASCII(o2) {
return (function(n2, o3) {
const e2 = n2.split("@");
let r2 = "";
e2.length > 1 && (r2 = e2[0] + "@", n2 = e2[1]);
const s2 = (function(n3, t2) {
const o4 = [];
let e3 = n3.length;
for (; e3--; ) {
o4[e3] = t2(n3[e3]);
}
return o4;
})((n2 = n2.replace(t, ".")).split("."), o3).join(".");
return r2 + s2;
})(o2, function(t2) {
return n.test(t2) ? "xn--" + (function(n2) {
const t3 = [];
const o3 = (n2 = (function(n3) {
const t4 = [];
let o4 = 0;
const e2 = n3.length;
for (; o4 < e2; ) {
const r2 = n3.charCodeAt(o4++);
if (r2 >= 55296 && r2 <= 56319 && o4 < e2) {
const e3 = n3.charCodeAt(o4++);
(64512 & e3) == 56320 ? t4.push(((1023 & r2) << 10) + (1023 & e3) + 65536) : (t4.push(r2), o4--);
} else {
t4.push(r2);
}
}
return t4;
})(n2)).length;
let f = 128;
let i = 0;
let l = 72;
for (const o4 of n2) {
o4 < 128 && t3.push(r(o4));
}
const h = t3.length;
let p = h;
for (h && t3.push("-"); p < o3; ) {
let o4 = 2147483647;
for (const t4 of n2) {
t4 >= f && t4 < o4 && (o4 = t4);
}
const a = p + 1;
o4 - f > e((2147483647 - i) / a) && s("overflow"), i += (o4 - f) * a, f = o4;
for (const o5 of n2) {
if (o5 < f && ++i > 2147483647 && s("overflow"), o5 == f) {
let n3 = i;
for (let o6 = 36; ; o6 += 36) {
const s2 = o6 <= l ? 1 : o6 >= l + 26 ? 26 : o6 - l;
if (n3 < s2) {
break;
}
const u2 = n3 - s2;
const f2 = 36 - s2;
t3.push(r(c(s2 + u2 % f2, 0))), n3 = e(u2 / f2);
}
t3.push(r(c(n3, 0))), l = u(i, a, p == h), i = 0, ++p;
}
}
++i, ++f;
}
return t3.join("");
})(t2) : t2;
});
}
const HASH_RE = /#/g;
const AMPERSAND_RE = /&/g;
const SLASH_RE = /\//g;
const EQUAL_RE = /=/g;
const IM_RE = /\?/g;
const PLUS_RE = /\+/g;
const ENC_CARET_RE = /%5e/gi;
const ENC_BACKTICK_RE = /%60/gi;
const ENC_CURLY_OPEN_RE = /%7b/gi;
const ENC_PIPE_RE = /%7c/gi;
const ENC_CURLY_CLOSE_RE = /%7d/gi;
const ENC_SPACE_RE = /%20/gi;
const ENC_SLASH_RE = /%2f/gi;
const ENC_ENC_SLASH_RE = /%252f/gi;
function encode(text) {
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
}
function encodeHash(text) {
return encode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
}
function encodeQueryValue(input) {
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
}
function encodeQueryKey(text) {
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
}
function encodePath(text) {
return encode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F").replace(ENC_ENC_SLASH_RE, "%2F").replace(AMPERSAND_RE, "%26").replace(PLUS_RE, "%2B");
}
function encodeParam(text) {
return encodePath(text).replace(SLASH_RE, "%2F");
}
function decode(text = "") {
try {
return decodeURIComponent("" + text);
} catch {
return "" + text;
}
}
function decodePath(text) {
return decode(text.replace(ENC_SLASH_RE, "%252F"));
}
function decodeQueryKey(text) {
return decode(text.replace(PLUS_RE, " "));
}
function decodeQueryValue(text) {
return decode(text.replace(PLUS_RE, " "));
}
function encodeHost(name = "") {
return toASCII(name);
}
function parseQuery(parametersString = "") {
const object = /* @__PURE__ */ Object.create(null);
if (parametersString[0] === "?") {
parametersString = parametersString.slice(1);
}
for (const parameter of parametersString.split("&")) {
const s = parameter.match(/([^=]+)=?(.*)/) || [];
if (s.length < 2) {
continue;
}
const key = decodeQueryKey(s[1]);
if (key === "__proto__" || key === "constructor") {
continue;
}
const value = decodeQueryValue(s[2] || "");
if (object[key] === void 0) {
object[key] = value;
} else if (Array.isArray(object[key])) {
object[key].push(value);
} else {
object[key] = [object[key], value];
}
}
return object;
}
function encodeQueryItem(key, value) {
if (typeof value === "number" || typeof value === "boolean") {
value = String(value);
}
if (!value) {
return encodeQueryKey(key);
}
if (Array.isArray(value)) {
return value.map(
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
).join("&");
}
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
}
function stringifyQuery(query) {
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
}
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i;
const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
const JOIN_LEADING_SLASH_RE = /^\.?\//;
function isRelative(inputString) {
return ["./", "../"].some((string_) => inputString.startsWith(string_));
}
function hasProtocol(inputString, opts = {}) {
if (typeof opts === "boolean") {
opts = { acceptRelative: opts };
}
if (opts.strict) {
return PROTOCOL_STRICT_REGEX.test(inputString);
}
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
}
function isScriptProtocol(protocol) {
return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol);
}
function hasTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) {
return input.endsWith("/");
}
return TRAILING_SLASH_RE.test(input);
}
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) {
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
}
if (!hasTrailingSlash(input, true)) {
return input || "/";
}
let path = input;
let fragment = "";
const fragmentIndex = input.indexOf("#");
if (fragmentIndex !== -1) {
path = input.slice(0, fragmentIndex);
fragment = input.slice(fragmentIndex);
}
const [s0, ...s] = path.split("?");
const cleanPath = s0.endsWith("/") ? s0.slice(0, -1) : s0;
return (cleanPath || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
}
function withTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) {
return input.endsWith("/") ? input : input + "/";
}
if (hasTrailingSlash(input, true)) {
return input || "/";
}
let path = input;
let fragment = "";
const fragmentIndex = input.indexOf("#");
if (fragmentIndex !== -1) {
path = input.slice(0, fragmentIndex);
fragment = input.slice(fragmentIndex);
if (!path) {
return fragment;
}
}
const [s0, ...s] = path.split("?");
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
}
function hasLeadingSlash(input = "") {
return input.startsWith("/");
}
function withoutLeadingSlash(input = "") {
return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
}
function withLeadingSlash(input = "") {
return hasLeadingSlash(input) ? input : "/" + input;
}
function cleanDoubleSlashes(input = "") {
return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
}
function withBase(input, base) {
if (isEmptyURL(base) || hasProtocol(input)) {
return input;
}
const _base = withoutTrailingSlash(base);
if (input.startsWith(_base)) {
const nextChar = input[_base.length];
if (!nextChar || nextChar === "/" || nextChar === "?") {
return input;
}
}
return joinURL(_base, input);
}
function withoutBase(input, base) {
if (isEmptyURL(base)) {
return input;
}
const _base = withoutTrailingSlash(base);
if (!input.startsWith(_base)) {
return input;
}
const nextChar = input[_base.length];
if (nextChar && nextChar !== "/" && nextChar !== "?") {
return input;
}
const trimmed = input.slice(_base.length);
return trimmed[0] === "/" ? trimmed : "/" + trimmed;
}
function withQuery(input, query) {
const parsed = parseURL(input);
const mergedQuery = { ...parseQuery(parsed.search), ...query };
parsed.search = stringifyQuery(mergedQuery);
return stringifyParsedURL(parsed);
}
function filterQuery(input, predicate) {
if (!input.includes("?")) {
return input;
}
const parsed = parseURL(input);
const query = parseQuery(parsed.search);
const filteredQuery = Object.fromEntries(
Object.entries(query).filter(([key, value]) => predicate(key, value))
);
parsed.search = stringifyQuery(filteredQuery);
return stringifyParsedURL(parsed);
}
function getQuery(input) {
return parseQuery(parseURL(input).search);
}
function isEmptyURL(url) {
return !url || url === "/";
}
function isNonEmptyURL(url) {
return url && url !== "/";
}
function joinURL(base, ...input) {
let url = base || "";
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
if (url) {
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
url = withTrailingSlash(url) + _segment;
} else {
url = segment;
}
}
return url;
}
function joinRelativeURL(..._input) {
const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
const input = _input.filter(Boolean);
const segments = [];
let segmentsDepth = 0;
for (const i of input) {
if (!i || i === "/") {
continue;
}
for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
if (!s || s === ".") {
continue;
}
if (s === "..") {
if (segments.length === 1 && hasProtocol(segments[0])) {
continue;
}
segments.pop();
segmentsDepth--;
continue;
}
if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
segments[segments.length - 1] += "/" + s;
continue;
}
segments.push(s);
segmentsDepth++;
}
}
let url = segments.join("/");
if (segmentsDepth >= 0) {
if (input[0]?.startsWith("/") && !url.startsWith("/")) {
url = "/" + url;
} else if (input[0]?.startsWith("./") && !url.startsWith("./")) {
url = "./" + url;
}
} else {
url = "../".repeat(-1 * segmentsDepth) + url;
}
if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) {
url += "/";
}
return url;
}
function withHttp(input) {
return withProtocol(input, "http://");
}
function withHttps(input) {
return withProtocol(input, "https://");
}
function withoutProtocol(input) {
return withProtocol(input, "");
}
function withProtocol(input, protocol) {
let match = input.match(PROTOCOL_REGEX);
if (!match) {
match = input.match(/^\/{2,}/);
}
if (!match) {
return protocol + input;
}
return protocol + input.slice(match[0].length);
}
function normalizeURL(input) {
const parsed = parseURL(input);
parsed.pathname = encodePath(decodePath(parsed.pathname));
parsed.hash = encodeHash(decode(parsed.hash));
parsed.host = encodeHost(decode(parsed.host));
parsed.search = stringifyQuery(parseQuery(parsed.search));
return stringifyParsedURL(parsed);
}
function resolveURL(base = "", ...inputs) {
if (typeof base !== "string") {
throw new TypeError(
`URL input should be string received ${typeof base} (${base})`
);
}
const filteredInputs = inputs.filter((input) => isNonEmptyURL(input));
if (filteredInputs.length === 0) {
return base;
}
const url = parseURL(base);
for (const inputSegment of filteredInputs) {
const urlSegment = parseURL(inputSegment);
if (urlSegment.pathname) {
url.pathname = withTrailingSlash(url.pathname) + withoutLeadingSlash(urlSegment.pathname);
}
if (urlSegment.hash && urlSegment.hash !== "#") {
url.hash = urlSegment.hash;
}
if (urlSegment.search && urlSegment.search !== "?") {
if (url.search && url.search !== "?") {
const queryString = stringifyQuery({
...parseQuery(url.search),
...parseQuery(urlSegment.search)
});
url.search = queryString.length > 0 ? "?" + queryString : "";
} else {
url.search = urlSegment.search;
}
}
}
return stringifyParsedURL(url);
}
function isSamePath(p1, p2) {
return decode(withoutTrailingSlash(p1)) === decode(withoutTrailingSlash(p2));
}
function isEqual(a, b, options = {}) {
if (!options.trailingSlash) {
a = withTrailingSlash(a);
b = withTrailingSlash(b);
}
if (!options.leadingSlash) {
a = withLeadingSlash(a);
b = withLeadingSlash(b);
}
if (!options.encoding) {
a = decode(a);
b = decode(b);
}
return a === b;
}
function withFragment(input, hash) {
if (!hash || hash === "#") {
return input;
}
const parsed = parseURL(input);
parsed.hash = hash === "" ? "" : "#" + encodeHash(hash);
return stringifyParsedURL(parsed);
}
function withoutFragment(input) {
return stringifyParsedURL({ ...parseURL(input), hash: "" });
}
function withoutHost(input) {
const parsed = parseURL(input);
return (parsed.pathname || "/") + parsed.search + parsed.hash;
}
const protocolRelative = Symbol.for("ufo:protocolRelative");
function parseURL(input = "", defaultProto) {
const _specialProtoMatch = input.match(
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
);
if (_specialProtoMatch) {
const [, _proto, _pathname = ""] = _specialProtoMatch;
return {
protocol: _proto.toLowerCase(),
pathname: _pathname,
href: _proto + _pathname,
auth: "",
host: "",
search: "",
hash: ""
};
}
if (!hasProtocol(input, { acceptRelative: true })) {
return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
}
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
if (protocol === "file:") {
path = path.replace(/\/(?=[A-Za-z]:)/, "");
}
const { pathname, search, hash } = parsePath(path);
return {
protocol: protocol.toLowerCase(),
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
host,
pathname,
search,
hash,
[protocolRelative]: !protocol
};
}
function parsePath(input = "") {
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
return {
pathname,
search,
hash
};
}
function parseAuth(input = "") {
const [username, password] = input.split(":");
return {
username: decode(username),
password: decode(password)
};
}
function parseHost(input = "") {
const [hostname, port] = (input.match(/([^/:]*):?(\d+)?/) || []).splice(1);
return {
hostname: decode(hostname),
port
};
}
function stringifyParsedURL(parsed) {
const pathname = parsed.pathname || "";
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
const hash = parsed.hash || "";
const auth = parsed.auth ? parsed.auth + "@" : "";
const host = parsed.host || "";
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
return proto + auth + host + pathname + search + hash;
}
const FILENAME_STRICT_REGEX = /\/([^/]+\.[^/]+)$/;
const FILENAME_REGEX = /\/([^/]+)$/;
function parseFilename(input = "", opts) {
const { pathname } = parseURL(input);
const matches = opts?.strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);
return matches ? matches[1] : void 0;
}
class $URL {
protocol;
host;
auth;
pathname;
query = {};
hash;
constructor(input = "") {
if (typeof input !== "string") {
throw new TypeError(
`URL input should be string received ${typeof input} (${input})`
);
}
const parsed = parseURL(input);
this.protocol = decode(parsed.protocol);
this.host = decode(parsed.host);
this.auth = decode(parsed.auth);
this.pathname = decodePath(parsed.pathname);
this.query = parseQuery(parsed.search);
this.hash = decode(parsed.hash);
}
get hostname() {
return parseHost(this.host).hostname;
}
get port() {
return parseHost(this.host).port || "";
}
get username() {
return parseAuth(this.auth).username;
}
get password() {
return parseAuth(this.auth).password || "";
}
get hasProtocol() {
return this.protocol.length;
}
get isAbsolute() {
return this.hasProtocol || this.pathname[0] === "/";
}
get search() {
const q = stringifyQuery(this.query);
return q.length > 0 ? "?" + q : "";
}
get searchParams() {
const p = new URLSearchParams();
for (const name in this.query) {
const value = this.query[name];
if (Array.isArray(value)) {
for (const v of value) {
p.append(name, v);
}
} else {
p.append(
name,
typeof value === "string" ? value : JSON.stringify(value)
);
}
}
return p;
}
get origin() {
return (this.protocol ? this.protocol + "//" : "") + encodeHost(this.host);
}
get fullpath() {
return encodePath(this.pathname) + this.search + encodeHash(this.hash);
}
get encodedAuth() {
if (!this.auth) {
return "";
}
const { username, password } = parseAuth(this.auth);
return encodeURIComponent(username) + (password ? ":" + encodeURIComponent(password) : "");
}
get href() {
const auth = this.encodedAuth;
const originWithAuth = (this.protocol ? this.protocol + "//" : "") + (auth ? auth + "@" : "") + encodeHost(this.host);
return this.hasProtocol && this.isAbsolute ? originWithAuth + this.fullpath : this.fullpath;
}
append(url) {
if (url.hasProtocol) {
throw new Error("Cannot append a URL with protocol");
}
Object.assign(this.query, url.query);
if (url.pathname) {
this.pathname = withTrailingSlash(this.pathname) + withoutLeadingSlash(url.pathname);
}
if (url.hash) {
this.hash = url.hash;
}
}
toJSON() {
return this.href;
}
toString() {
return this.href;
}
}
function createURL(input) {
return new $URL(input);
}
export { $URL, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryKey, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, filterQuery, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, joinRelativeURL, joinURL, normalizeURL, parseAuth, parseFilename, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withFragment, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutFragment, withoutHost, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash };

48
.output/server/node_modules/ufo/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "ufo",
"version": "1.6.3",
"description": "URL utils for humans",
"repository": "unjs/ufo",
"license": "MIT",
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
},
"./*": "./*"
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "automd && unbuild",
"automd": "automd",
"dev": "vitest",
"lint": "eslint . && prettier -c src test",
"lint:fix": "eslint --fix . && prettier -w src test",
"prepack": "pnpm build",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm lint && vitest run --typecheck"
},
"devDependencies": {
"@types/node": "^25.0.8",
"@vitest/coverage-v8": "^4.0.17",
"automd": "^0.4.2",
"changelogen": "^0.6.2",
"eslint": "^9.39.2",
"eslint-config-unjs": "^0.6.2",
"jiti": "^2.6.1",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"unbuild": "^3.6.1",
"untyped": "^2.0.0",
"vitest": "^4.0.17"
},
"packageManager": "pnpm@10.28.0"
}

9
.output/server/node_modules/unhead/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.BPM0-cfG.mjs';
export { c as createHeadCore, a as createUnhead } from './shared/unhead.BFfcxOoW.mjs';
export { u as useScript } from './shared/unhead.B578PsDV.mjs';
import './shared/unhead.CApf5sj3.mjs';
import './shared/unhead.DQc16pHI.mjs';
import './shared/unhead.yem5I2v_.mjs';
import 'hookable';
import './shared/unhead.eK9_7LaY.mjs';
import './shared/unhead.CbpEuj3y.mjs';

508
.output/server/node_modules/unhead/dist/parser.mjs generated vendored Normal file
View File

@@ -0,0 +1,508 @@
const TAG_HTML = 0;
const TAG_HEAD = 1;
const TAG_TITLE = 4;
const TAG_META = 5;
const TAG_BODY = 44;
const TAG_SCRIPT = 52;
const TAG_STYLE = 53;
const TAG_LINK = 54;
const TAG_BASE = 56;
const LT_CHAR = 60;
const GT_CHAR = 62;
const SLASH_CHAR = 47;
const EQUALS_CHAR = 61;
const QUOTE_CHAR = 34;
const APOS_CHAR = 39;
const EXCLAMATION_CHAR = 33;
const BACKSLASH_CHAR = 92;
const DASH_CHAR = 45;
const TagIdMap = {
html: TAG_HTML,
head: TAG_HEAD,
title: TAG_TITLE,
meta: TAG_META,
body: TAG_BODY,
script: TAG_SCRIPT,
style: TAG_STYLE,
link: TAG_LINK,
base: TAG_BASE
};
function isWhitespace(charCode) {
return charCode === 32 || charCode === 9 || charCode === 10 || charCode === 13;
}
function processCommentOrDoctype(htmlChunk, position) {
let i = position;
const chunkLength = htmlChunk.length;
if (i + 3 < chunkLength && htmlChunk.charCodeAt(i + 2) === DASH_CHAR && htmlChunk.charCodeAt(i + 3) === DASH_CHAR) {
i += 4;
while (i < chunkLength - 2) {
if (htmlChunk.charCodeAt(i) === DASH_CHAR && htmlChunk.charCodeAt(i + 1) === DASH_CHAR && htmlChunk.charCodeAt(i + 2) === GT_CHAR) {
i += 3;
return {
complete: true,
newPosition: i,
remainingText: ""
};
}
i++;
}
return {
complete: false,
newPosition: position,
remainingText: htmlChunk.substring(position)
};
} else {
i += 2;
while (i < chunkLength) {
if (htmlChunk.charCodeAt(i) === GT_CHAR) {
i++;
return {
complete: true,
newPosition: i,
remainingText: ""
};
}
i++;
}
return {
complete: false,
newPosition: i,
remainingText: htmlChunk.substring(position, i)
};
}
}
function parseAttributes(attrStr) {
if (!attrStr)
return {};
const result = {};
const len = attrStr.length;
let i = 0;
const WHITESPACE = 0;
const NAME = 1;
const AFTER_NAME = 2;
const BEFORE_VALUE = 3;
const QUOTED_VALUE = 4;
const UNQUOTED_VALUE = 5;
let state = WHITESPACE;
let nameStart = 0;
let nameEnd = 0;
let valueStart = 0;
let quoteChar = 0;
let name = "";
while (i < len) {
const charCode = attrStr.charCodeAt(i);
const isSpace = isWhitespace(charCode);
switch (state) {
case WHITESPACE:
if (!isSpace) {
state = NAME;
nameStart = i;
nameEnd = 0;
}
break;
case NAME:
if (charCode === EQUALS_CHAR || isSpace) {
nameEnd = i;
name = attrStr.substring(nameStart, nameEnd).toLowerCase();
state = charCode === EQUALS_CHAR ? BEFORE_VALUE : AFTER_NAME;
}
break;
case AFTER_NAME:
if (charCode === EQUALS_CHAR) {
state = BEFORE_VALUE;
} else if (!isSpace) {
result[name] = "";
state = NAME;
nameStart = i;
nameEnd = 0;
}
break;
case BEFORE_VALUE:
if (charCode === QUOTE_CHAR || charCode === APOS_CHAR) {
quoteChar = charCode;
state = QUOTED_VALUE;
valueStart = i + 1;
} else if (!isSpace) {
state = UNQUOTED_VALUE;
valueStart = i;
}
break;
case QUOTED_VALUE:
if (charCode === BACKSLASH_CHAR && i + 1 < len) {
i++;
} else if (charCode === quoteChar) {
result[name] = attrStr.substring(valueStart, i);
state = WHITESPACE;
}
break;
case UNQUOTED_VALUE:
if (isSpace || charCode === GT_CHAR) {
result[name] = attrStr.substring(valueStart, i);
state = WHITESPACE;
}
break;
}
i++;
}
if (state === QUOTED_VALUE || state === UNQUOTED_VALUE) {
if (name) {
result[name] = attrStr.substring(valueStart, i);
}
} else if (state === NAME || state === AFTER_NAME || state === BEFORE_VALUE) {
nameEnd = nameEnd || i;
const currentName = attrStr.substring(nameStart, nameEnd).toLowerCase();
if (currentName) {
result[currentName] = "";
}
}
return result;
}
function parseHtmlForIndexes(html) {
const indexes = {
htmlTagStart: html.indexOf("<html"),
htmlTagEnd: -1,
headTagEnd: html.indexOf("</head>"),
bodyTagStart: html.indexOf("<body"),
bodyTagEnd: -1,
bodyCloseTagStart: html.indexOf("</body>")
};
if (indexes.htmlTagStart >= 0) {
const htmlTagEndPos = html.indexOf(">", indexes.htmlTagStart);
if (htmlTagEndPos >= 0) {
indexes.htmlTagEnd = htmlTagEndPos + 1;
}
}
if (indexes.bodyTagStart >= 0) {
const bodyTagEndPos = html.indexOf(">", indexes.bodyTagStart);
if (bodyTagEndPos >= 0) {
indexes.bodyTagEnd = bodyTagEndPos + 1;
}
}
return { html, input: {}, indexes };
}
function parseHtmlForUnheadExtraction(html) {
const input = {};
const htmlParts = [];
let position = 0;
let inHead = false;
let foundBodyStart = false;
let lastCopyPosition = 0;
let currentOutputLength = 0;
const indexes = {
htmlTagStart: -1,
htmlTagEnd: -1,
headTagEnd: -1,
bodyTagStart: -1,
bodyTagEnd: -1,
bodyCloseTagStart: -1
};
const headElementsToExtract = /* @__PURE__ */ new Set([TAG_TITLE, TAG_META, TAG_LINK, TAG_SCRIPT, TAG_STYLE, TAG_BASE]);
function copyAccumulatedText() {
if (lastCopyPosition < position) {
const textToAdd = html.substring(lastCopyPosition, position);
htmlParts.push(textToAdd);
currentOutputLength += textToAdd.length;
lastCopyPosition = position;
}
}
function addText(text) {
htmlParts.push(text);
currentOutputLength += text.length;
}
while (position < html.length && !foundBodyStart) {
const currentCharCode = html.charCodeAt(position);
if (currentCharCode !== LT_CHAR) {
position++;
continue;
}
if (position + 1 >= html.length) {
copyAccumulatedText();
addText(html[position]);
break;
}
const nextCharCode = html.charCodeAt(position + 1);
if (nextCharCode === EXCLAMATION_CHAR) {
const result = processCommentOrDoctype(html, position);
if (result.complete) {
copyAccumulatedText();
addText(html.substring(position, result.newPosition));
position = result.newPosition;
lastCopyPosition = position;
} else {
copyAccumulatedText();
addText(html.substring(position));
break;
}
continue;
}
if (nextCharCode === SLASH_CHAR) {
let tagEnd2 = position + 2;
while (tagEnd2 < html.length && html.charCodeAt(tagEnd2) !== GT_CHAR) {
tagEnd2++;
}
if (tagEnd2 >= html.length) {
copyAccumulatedText();
addText(html.substring(position));
break;
}
const tagName2 = html.substring(position + 2, tagEnd2).toLowerCase().trim();
const tagId2 = TagIdMap[tagName2] ?? -1;
if (tagId2 === TAG_HEAD) {
inHead = false;
copyAccumulatedText();
const headCloseStart = currentOutputLength;
addText(html.substring(position, tagEnd2 + 1));
indexes.headTagEnd = headCloseStart;
} else {
copyAccumulatedText();
addText(html.substring(position, tagEnd2 + 1));
}
position = tagEnd2 + 1;
lastCopyPosition = position;
continue;
}
const tagStart = position + 1;
let tagNameEnd = tagStart;
while (tagNameEnd < html.length) {
const c = html.charCodeAt(tagNameEnd);
if (isWhitespace(c) || c === SLASH_CHAR || c === GT_CHAR) {
break;
}
tagNameEnd++;
}
if (tagNameEnd >= html.length) {
copyAccumulatedText();
addText(html.substring(position));
break;
}
const tagName = html.substring(tagStart, tagNameEnd).toLowerCase();
const tagId = TagIdMap[tagName] ?? -1;
let tagEnd = tagNameEnd;
let inQuote = false;
let quoteChar = 0;
let foundEnd = false;
let isSelfClosing = false;
while (tagEnd < html.length && !foundEnd) {
const c = html.charCodeAt(tagEnd);
if (inQuote) {
if (c === quoteChar) {
inQuote = false;
}
} else if (c === QUOTE_CHAR || c === APOS_CHAR) {
inQuote = true;
quoteChar = c;
} else if (c === SLASH_CHAR && tagEnd + 1 < html.length && html.charCodeAt(tagEnd + 1) === GT_CHAR) {
isSelfClosing = true;
tagEnd += 2;
foundEnd = true;
continue;
} else if (c === GT_CHAR) {
tagEnd++;
foundEnd = true;
continue;
}
tagEnd++;
}
if (!foundEnd) {
copyAccumulatedText();
addText(html.substring(position));
break;
}
const attributesStr = html.substring(tagNameEnd, tagEnd - (isSelfClosing ? 2 : 1)).trim();
const attributes = parseAttributes(attributesStr);
if (tagId === TAG_HTML) {
copyAccumulatedText();
indexes.htmlTagStart = currentOutputLength;
if (Object.keys(attributes).length > 0) {
input.htmlAttrs = attributes;
addText(`<${tagName}>`);
} else {
addText(html.substring(position, tagEnd));
}
indexes.htmlTagEnd = currentOutputLength;
} else if (tagId === TAG_BODY) {
copyAccumulatedText();
indexes.bodyTagStart = currentOutputLength;
if (Object.keys(attributes).length > 0) {
input.bodyAttrs = attributes;
addText(`<${tagName}>`);
} else {
addText(html.substring(position, tagEnd));
}
indexes.bodyTagEnd = currentOutputLength;
foundBodyStart = true;
position = tagEnd;
lastCopyPosition = position;
break;
} else if (tagId === TAG_HEAD) {
inHead = true;
copyAccumulatedText();
addText(html.substring(position, tagEnd));
} else if (inHead && headElementsToExtract.has(tagId)) {
if (tagId === TAG_TITLE) {
if (!isSelfClosing) {
const titleEnd = findClosingTag(html, tagEnd, tagName);
if (titleEnd !== -1) {
const titleContent = html.substring(tagEnd, titleEnd).trim();
if (titleContent && !input.title) {
input.title = titleContent;
}
position = findTagEnd(html, titleEnd, tagName);
lastCopyPosition = position;
continue;
}
}
} else if (tagId === TAG_SCRIPT) {
const scriptAttrs = { ...attributes };
if (!isSelfClosing) {
const scriptEnd = findClosingTag(html, tagEnd, tagName);
if (scriptEnd !== -1) {
const scriptContent = html.substring(tagEnd, scriptEnd);
scriptAttrs.innerHTML = scriptContent || "";
position = findTagEnd(html, scriptEnd, tagName);
} else {
scriptAttrs.innerHTML = "";
position = tagEnd;
}
} else {
scriptAttrs.innerHTML = "";
position = tagEnd;
}
lastCopyPosition = position;
(input.script ||= []).push(scriptAttrs);
continue;
} else if (tagId === TAG_STYLE) {
const styleAttrs = { ...attributes };
if (!isSelfClosing) {
const styleEnd = findClosingTag(html, tagEnd, tagName);
if (styleEnd !== -1) {
const styleContent = html.substring(tagEnd, styleEnd);
styleAttrs.textContent = styleContent || "";
position = findTagEnd(html, styleEnd, tagName);
} else {
styleAttrs.textContent = "";
position = tagEnd;
}
} else {
styleAttrs.textContent = "";
position = tagEnd;
}
lastCopyPosition = position;
(input.style ||= []).push(styleAttrs);
continue;
} else if (tagId === TAG_META) {
(input.meta ||= []).push(attributes);
position = tagEnd;
lastCopyPosition = position;
continue;
} else if (tagId === TAG_LINK) {
(input.link ||= []).push(attributes);
position = tagEnd;
lastCopyPosition = position;
continue;
} else if (tagId === TAG_BASE && !input.base) {
input.base = attributes;
position = tagEnd;
lastCopyPosition = position;
continue;
}
} else {
copyAccumulatedText();
addText(html.substring(position, tagEnd));
}
position = tagEnd;
lastCopyPosition = position;
}
const remainingHtml = html.substring(position);
const bodyCloseIndex = remainingHtml.indexOf("</body>");
if (bodyCloseIndex !== -1) {
indexes.bodyCloseTagStart = currentOutputLength + bodyCloseIndex;
}
copyAccumulatedText();
addText(remainingHtml);
return { html: htmlParts.join(""), input, indexes };
}
function findClosingTag(html, startPos, tagName) {
const tagId = TagIdMap[tagName];
const isScriptOrStyle = tagId === TAG_SCRIPT || tagId === TAG_STYLE;
if (!isScriptOrStyle) {
const closingTag2 = `</${tagName}`;
const index = html.indexOf(closingTag2, startPos);
return index === -1 ? -1 : index;
}
const closingTag = `</${tagName}`;
let pos = startPos;
let inSingleQuote = false;
let inDoubleQuote = false;
let inBacktick = false;
let lastCharWasBackslash = false;
while (pos < html.length) {
const currentCharCode = html.charCodeAt(pos);
if (!lastCharWasBackslash) {
if (currentCharCode === APOS_CHAR && !inDoubleQuote && !inBacktick) {
inSingleQuote = !inSingleQuote;
} else if (currentCharCode === QUOTE_CHAR && !inSingleQuote && !inBacktick) {
inDoubleQuote = !inDoubleQuote;
} else if (currentCharCode === 96 && !inSingleQuote && !inDoubleQuote) {
inBacktick = !inBacktick;
}
}
lastCharWasBackslash = currentCharCode === BACKSLASH_CHAR && !lastCharWasBackslash;
const inQuotes = inSingleQuote || inDoubleQuote || inBacktick;
if (!inQuotes && html.startsWith(closingTag, pos)) {
const afterTagPos = pos + closingTag.length;
if (afterTagPos >= html.length) {
return pos;
}
const nextChar = html.charCodeAt(afterTagPos);
if (nextChar === GT_CHAR || isWhitespace(nextChar)) {
return pos;
}
}
pos++;
}
return -1;
}
function findTagEnd(html, closingTagStart, tagName) {
let pos = closingTagStart + tagName.length + 2;
while (pos < html.length && html.charCodeAt(pos) !== GT_CHAR) {
pos++;
}
return pos < html.length ? pos + 1 : pos;
}
function applyHeadToHtml(template, headHtml) {
const { html, indexes } = template;
const parts = [];
let lastIndex = 0;
if (indexes.htmlTagStart >= 0) {
parts.push(html.substring(lastIndex, indexes.htmlTagStart));
parts.push(`<html${headHtml.htmlAttrs}>`);
lastIndex = indexes.htmlTagEnd;
}
if (indexes.headTagEnd >= 0) {
parts.push(html.substring(lastIndex, indexes.headTagEnd));
parts.push(headHtml.headTags);
parts.push("</head>");
lastIndex = indexes.headTagEnd + 7;
}
if (indexes.bodyTagStart >= 0) {
parts.push(html.substring(lastIndex, indexes.bodyTagStart));
if (headHtml.bodyTagsOpen) {
parts.push(`<body${headHtml.bodyAttrs}>
${headHtml.bodyTagsOpen}`);
} else {
parts.push(`<body${headHtml.bodyAttrs}>`);
}
lastIndex = indexes.bodyTagEnd;
}
if (indexes.bodyCloseTagStart >= 0) {
parts.push(html.substring(lastIndex, indexes.bodyCloseTagStart));
parts.push(headHtml.bodyTags);
parts.push(html.substring(indexes.bodyCloseTagStart));
} else {
parts.push(html.substring(lastIndex));
}
return parts.join("");
}
export { TagIdMap, applyHeadToHtml, parseAttributes, parseHtmlForIndexes, parseHtmlForUnheadExtraction };

101
.output/server/node_modules/unhead/dist/plugins.mjs generated vendored Normal file
View File

@@ -0,0 +1,101 @@
export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.ckV6dpEQ.mjs';
import { d as defineHeadPlugin } from './shared/unhead.CApf5sj3.mjs';
export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.CApf5sj3.mjs';
import './shared/unhead.CbpEuj3y.mjs';
import './shared/unhead.BYvz9V1x.mjs';
import './shared/unhead.DQc16pHI.mjs';
import './shared/unhead.yem5I2v_.mjs';
const META_TRANSFORMABLE_URL = [
"og:url",
"og:image",
"og:image:secure_url",
"twitter:image",
"twitter:image:src",
"og:video",
"og:video:secure_url",
"og:see_also"
];
function CanonicalPlugin(options) {
return (head) => {
let host = options.canonicalHost || (!head.ssr ? window.location.origin : "");
if (!host.startsWith("http") && !host.startsWith("//")) {
host = `https://${host}`;
}
host = new URL(host).origin;
function resolvePath(path) {
if (options?.customResolver) {
return options.customResolver(path);
}
if (path.startsWith("http") || path.startsWith("//"))
return path;
try {
return new URL(path, host).toString();
} catch {
return path;
}
}
return {
key: "canonical",
hooks: {
"tags:resolve": (ctx) => {
for (const tag of ctx.tags) {
if (tag.tag === "meta" && (META_TRANSFORMABLE_URL.includes(tag.props?.property) || META_TRANSFORMABLE_URL.includes(tag.props?.name))) {
tag.props.content = resolvePath(tag.props.content);
} else if (tag.tag === "link" && tag.props.rel === "canonical") {
tag.props.href = resolvePath(tag.props.href);
}
}
}
}
};
};
}
function InferSeoMetaPlugin(options = {}) {
return defineHeadPlugin((head) => {
head.push({
meta: [
{
name: "twitter:card",
content: options.twitterCard || "summary_large_image",
tagPriority: "low"
},
{
"property": "og:title",
"tagPriority": "low",
"data-infer": ""
},
{
"property": "og:description",
"tagPriority": "low",
"data-infer": ""
}
]
});
return {
key: "infer-seo-meta",
hooks: {
"tags:beforeResolve": ({ tagMap }) => {
let title = head._titleTemplate || head._title;
const ogTitle = tagMap.get("meta:og:title");
if (typeof ogTitle?.props["data-infer"] !== "undefined") {
if (typeof title === "function") {
title = title(head._title);
}
ogTitle.props.content = options.ogTitle ? options.ogTitle(title) : title || "";
ogTitle.processTemplateParams = true;
}
const description = tagMap.get("meta:description")?.props?.content;
const ogDescription = tagMap.get("meta:og:description");
if (typeof ogDescription?.props["data-infer"] !== "undefined") {
ogDescription.props.content = options.ogDescription ? options.ogDescription(description) : description || "";
ogDescription.processTemplateParams = true;
}
}
}
};
});
}
export { CanonicalPlugin, InferSeoMetaPlugin, defineHeadPlugin };

30
.output/server/node_modules/unhead/dist/scripts.mjs generated vendored Normal file
View File

@@ -0,0 +1,30 @@
export { r as resolveScriptKey, u as useScript } from './shared/unhead.B578PsDV.mjs';
import './shared/unhead.yem5I2v_.mjs';
function createSpyProxy(target, onApply) {
const stack = [];
let stackIdx = -1;
const handler = (reuseStack = false) => ({
get(_, prop, receiver) {
if (!reuseStack) {
stackIdx++;
stack[stackIdx] = [];
}
const v = Reflect.get(_, prop, receiver);
if (typeof v === "object" || typeof v === "function") {
stack[stackIdx].push({ type: "get", key: prop });
return new Proxy(v, handler(true));
}
stack[stackIdx].push({ type: "get", key: prop, value: v });
return v;
},
apply(_, __, args) {
stack[stackIdx].push({ type: "apply", key: "", args });
onApply(stack);
return Reflect.apply(_, __, args);
}
});
return new Proxy(target, handler());
}
export { createSpyProxy };

180
.output/server/node_modules/unhead/dist/server.mjs generated vendored Normal file
View File

@@ -0,0 +1,180 @@
import { a as createUnhead } from './shared/unhead.BFfcxOoW.mjs';
import { T as TagsWithInnerContent, S as SelfClosingTags } from './shared/unhead.yem5I2v_.mjs';
import { parseHtmlForUnheadExtraction, applyHeadToHtml, parseHtmlForIndexes } from './parser.mjs';
import 'hookable';
import './shared/unhead.eK9_7LaY.mjs';
import './shared/unhead.CbpEuj3y.mjs';
// @__NO_SIDE_EFFECTS__
function createHead(options = {}) {
const unhead = createUnhead({
...options,
// @ts-expect-error untyped
document: false,
propResolvers: [
...options.propResolvers || [],
(k, v) => {
if (k && k.startsWith("on") && typeof v === "function") {
return `this.dataset.${k}fired = true`;
}
return v;
}
],
init: [
options.disableDefaults ? void 0 : {
htmlAttrs: {
lang: "en"
},
meta: [
{
charset: "utf-8"
},
{
name: "viewport",
content: "width=device-width, initial-scale=1"
}
]
},
...options.init || []
]
});
unhead._ssrPayload = {};
unhead.use({
key: "server",
hooks: {
"tags:resolve": function(ctx) {
const title = ctx.tagMap.get("title");
const titleTemplate = ctx.tagMap.get("titleTemplate");
let payload = {
title: title?.mode === "server" ? unhead._title : void 0,
titleTemplate: titleTemplate?.mode === "server" ? unhead._titleTemplate : void 0
};
if (Object.keys(unhead._ssrPayload || {}).length > 0) {
payload = {
...unhead._ssrPayload,
...payload
};
}
if (Object.values(payload).some(Boolean)) {
ctx.tags.push({
tag: "script",
innerHTML: JSON.stringify(payload),
props: { id: "unhead:payload", type: "application/json" }
});
}
}
}
});
return unhead;
}
function extractUnheadInputFromHtml(html) {
return parseHtmlForUnheadExtraction(html);
}
function encodeAttribute(value) {
return String(value).replace(/"/g, "&quot;");
}
function propsToString(props) {
let attrs = "";
for (const key in props) {
if (!Object.hasOwn(props, key))
continue;
let value = props[key];
if ((key === "class" || key === "style") && typeof value !== "string") {
value = key === "class" ? Array.from(value).join(" ") : Array.from(value).map(([k, v]) => `${k}:${v}`).join(";");
}
if (value !== false && value !== null) {
attrs += value === true ? ` ${key}` : ` ${key}="${encodeAttribute(value)}"`;
}
}
return attrs;
}
function escapeHtml(str) {
return str.replace(/[&<>"'/]/g, (char) => {
switch (char) {
case "&":
return "&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.has(tag.tag))
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
let content = String(tag.textContent || tag.innerHTML || "");
content = tag.tag === "title" ? escapeHtml(content) : content.replace(new RegExp(`</${tag.tag}`, "gi"), `<\\/${tag.tag}`);
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
}
function ssrRenderTags(tags, options) {
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: "", bodyClose: "", bodyOpen: "" } };
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
for (const tag of tags) {
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
Object.assign(schema[tag.tag], tag.props);
continue;
}
const s = tagToString(tag);
const tagPosition = tag.tagPosition || "head";
schema.tags[tagPosition] += schema.tags[tagPosition] ? `${lineBreaks}${s}` : s;
}
return {
headTags: schema.tags.head,
bodyTags: schema.tags.bodyClose,
bodyTagsOpen: schema.tags.bodyOpen,
htmlAttrs: propsToString(schema.htmlAttrs),
bodyAttrs: propsToString(schema.bodyAttrs)
};
}
// @__NO_SIDE_EFFECTS__
async function renderSSRHead(head, options) {
const beforeRenderCtx = { shouldRender: true };
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
if (!beforeRenderCtx.shouldRender) {
return {
headTags: "",
bodyTags: "",
bodyTagsOpen: "",
htmlAttrs: "",
bodyAttrs: ""
};
}
const ctx = { tags: options?.resolvedTags || await head.resolveTags() };
await head.hooks.callHook("ssr:render", ctx);
const html = ssrRenderTags(ctx.tags, options);
const renderCtx = { tags: ctx.tags, html };
await head.hooks.callHook("ssr:rendered", renderCtx);
return renderCtx.html;
}
// @__NO_SIDE_EFFECTS__
async function transformHtmlTemplate(head, html, options) {
const template = parseHtmlForUnheadExtraction(html);
head.push(template.input, { _index: 0 });
const headHtml = await renderSSRHead(head, options);
return applyHeadToHtml(template, headHtml);
}
// @__NO_SIDE_EFFECTS__
async function transformHtmlTemplateRaw(head, html, options) {
const headHtml = await renderSSRHead(head, options);
const template = parseHtmlForIndexes(html);
return applyHeadToHtml(template, headHtml);
}
export { createHead, escapeHtml, extractUnheadInputFromHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString, transformHtmlTemplate, transformHtmlTemplateRaw };

View File

@@ -0,0 +1,266 @@
import { b as ScriptNetworkEvents } from './unhead.yem5I2v_.mjs';
function createNoopedRecordingProxy(instance = {}) {
const stack = [];
let stackIdx = -1;
const handler = (reuseStack = false) => ({
get(_, prop, receiver) {
if (!reuseStack) {
const v = Reflect.get(_, prop, receiver);
if (typeof v !== "undefined") {
return v;
}
stackIdx++;
stack[stackIdx] = [];
}
stack[stackIdx].push({ type: "get", key: prop });
return new Proxy(() => {
}, handler(true));
},
apply(_, __, args) {
stack[stackIdx].push({ type: "apply", key: "", args });
return void 0;
}
});
return {
proxy: new Proxy(instance || {}, handler()),
stack
};
}
function createForwardingProxy(target) {
const handler = {
get(_, prop, receiver) {
const v = Reflect.get(_, prop, receiver);
if (typeof v === "object") {
return new Proxy(v, handler);
}
return v;
},
apply(_, __, args) {
Reflect.apply(_, __, args);
return void 0;
}
};
return new Proxy(target, handler);
}
function replayProxyRecordings(target, stack) {
stack.forEach((recordings) => {
let context = target;
let prevContext = target;
recordings.forEach(({ type, key, args }) => {
if (type === "get") {
prevContext = context;
context = context[key];
} else if (type === "apply") {
context = context.call(prevContext, ...args);
}
});
});
}
function resolveScriptKey(input) {
return input.key || input.src || (typeof input.innerHTML === "string" ? input.innerHTML : "");
}
const PreconnectServerModes = ["preconnect", "dns-prefetch"];
function useScript(head, _input, _options) {
const input = typeof _input === "string" ? { src: _input } : _input;
const options = _options || {};
const id = resolveScriptKey(input);
const prevScript = head._scripts?.[id];
if (prevScript) {
prevScript.setupTriggerHandler(options.trigger);
return prevScript;
}
options.beforeInit?.();
const syncStatus = (s) => {
script.status = s;
head.hooks.callHook(`script:updated`, hookCtx);
};
ScriptNetworkEvents.forEach((fn) => {
const k = fn;
const _fn = typeof input[k] === "function" ? input[k].bind(options.eventContext) : null;
input[k] = (e) => {
syncStatus(fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading");
_fn?.(e);
};
});
const _cbs = { loaded: [], error: [] };
const _uniqueCbs = /* @__PURE__ */ new Set();
const _registerCb = (key, cb, options2) => {
if (head.ssr) {
return;
}
if (options2?.key) {
const key2 = `${options2?.key}:${options2.key}`;
if (_uniqueCbs.has(key2)) {
return;
}
_uniqueCbs.add(key2);
}
if (_cbs[key]) {
const i = _cbs[key].push(cb);
return () => _cbs[key]?.splice(i - 1, 1);
}
cb(script.instance);
return () => {
};
};
const loadPromise = new Promise((resolve) => {
if (head.ssr)
return;
const emit = (api) => requestAnimationFrame(() => resolve(api));
const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
const status = script2.status;
if (script2.id === id && (status === "loaded" || status === "error")) {
if (status === "loaded") {
if (typeof options.use === "function") {
const api = options.use();
if (api) {
emit(api);
}
} else {
emit({});
}
} else if (status === "error") {
resolve(false);
}
_();
}
});
});
const script = {
_loadPromise: loadPromise,
instance: !head.ssr && options?.use?.() || null,
proxy: null,
id,
status: "awaitingLoad",
remove() {
script._triggerAbortController?.abort();
script._triggerPromises = [];
script._warmupEl?.dispose();
if (script.entry) {
script.entry.dispose();
script.entry = void 0;
syncStatus("removed");
delete head._scripts?.[id];
return true;
}
return false;
},
warmup(rel) {
const { src } = input;
const isCrossOrigin = !src.startsWith("/") || src.startsWith("//");
const isPreconnect = rel && PreconnectServerModes.includes(rel);
let href = src;
if (!rel || isPreconnect && !isCrossOrigin) {
return;
}
if (isPreconnect) {
const $url = new URL(src);
href = `${$url.protocol}//${$url.host}`;
}
const link = {
href,
rel,
crossorigin: typeof input.crossorigin !== "undefined" ? input.crossorigin : isCrossOrigin ? "anonymous" : void 0,
referrerpolicy: typeof input.referrerpolicy !== "undefined" ? input.referrerpolicy : isCrossOrigin ? "no-referrer" : void 0,
fetchpriority: typeof input.fetchpriority !== "undefined" ? input.fetchpriority : "low",
integrity: input.integrity,
as: rel === "preload" ? "script" : void 0
};
script._warmupEl = head.push({ link: [link] }, { head, tagPriority: "high" });
return script._warmupEl;
},
load(cb) {
script._triggerAbortController?.abort();
script._triggerPromises = [];
if (!script.entry) {
syncStatus("loading");
const defaults = {
defer: true,
fetchpriority: "low"
};
if (input.src && (input.src.startsWith("http") || input.src.startsWith("//"))) {
defaults.crossorigin = "anonymous";
defaults.referrerpolicy = "no-referrer";
}
script.entry = head.push({
script: [{ ...defaults, ...input }]
}, options);
}
if (cb)
_registerCb("loaded", cb);
return loadPromise;
},
onLoaded(cb, options2) {
return _registerCb("loaded", cb, options2);
},
onError(cb, options2) {
return _registerCb("error", cb, options2);
},
setupTriggerHandler(trigger) {
if (script.status !== "awaitingLoad") {
return;
}
if ((typeof trigger === "undefined" || trigger === "client") && !head.ssr || trigger === "server") {
script.load();
} else if (trigger instanceof Promise) {
if (head.ssr) {
return;
}
if (!script._triggerAbortController) {
script._triggerAbortController = new AbortController();
script._triggerAbortPromise = new Promise((resolve) => {
script._triggerAbortController.signal.addEventListener("abort", () => {
script._triggerAbortController = null;
resolve();
});
});
}
script._triggerPromises = script._triggerPromises || [];
const idx = script._triggerPromises.push(Promise.race([
trigger.then((v) => typeof v === "undefined" || v ? script.load : void 0),
script._triggerAbortPromise
]).catch(() => {
}).then((res) => {
res?.();
}).finally(() => {
script._triggerPromises?.splice(idx, 1);
}));
} else if (typeof trigger === "function") {
trigger(script.load);
}
},
_cbs
};
loadPromise.then((api) => {
if (api !== false) {
script.instance = api;
_cbs.loaded?.forEach((cb) => cb(api));
_cbs.loaded = null;
} else {
_cbs.error?.forEach((cb) => cb());
_cbs.error = null;
}
});
const hookCtx = { script };
script.setupTriggerHandler(options.trigger);
if (options.use) {
const { proxy, stack } = createNoopedRecordingProxy(head.ssr ? {} : options.use() || {});
script.proxy = proxy;
script.onLoaded((instance) => {
replayProxyRecordings(instance, stack);
script.proxy = createForwardingProxy(instance);
});
}
if (!options.warmupStrategy && (typeof options.trigger === "undefined" || options.trigger === "client")) {
options.warmupStrategy = "preload";
}
if (options.warmupStrategy) {
script.warmup(options.warmupStrategy);
}
head._scripts = Object.assign(head._scripts || {}, { [id]: script });
return script;
}
export { resolveScriptKey as r, useScript as u };

View File

@@ -0,0 +1,180 @@
import { createHooks } from 'hookable';
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.eK9_7LaY.mjs';
import { t as tagWeight, s as sortTags } from './unhead.CbpEuj3y.mjs';
import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
function registerPlugin(head, p) {
const plugin = typeof p === "function" ? p(head) : p;
const key = plugin.key || String(head.plugins.size + 1);
const exists = head.plugins.get(key);
if (!exists) {
head.plugins.set(key, plugin);
head.hooks.addHooks(plugin.hooks || {});
}
}
// @__NO_SIDE_EFFECTS__
function createHeadCore(resolvedOptions = {}) {
return /* @__PURE__ */ createUnhead(resolvedOptions);
}
// @__NO_SIDE_EFFECTS__
function createUnhead(resolvedOptions = {}) {
const hooks = createHooks();
hooks.addHooks(resolvedOptions.hooks || {});
const ssr = !resolvedOptions.document;
const entries = /* @__PURE__ */ new Map();
const plugins = /* @__PURE__ */ new Map();
const normalizeQueue = /* @__PURE__ */ new Set();
const head = {
_entryCount: 1,
// 0 is reserved for internal use
plugins,
dirty: false,
resolvedOptions,
hooks,
ssr,
entries,
headEntries() {
return [...entries.values()];
},
use: (p) => registerPlugin(head, p),
push(input, _options) {
const options = { ..._options || {} };
delete options.head;
const _i = options._index ?? head._entryCount++;
const inst = { _i, input, options };
const _ = {
_poll(rm = false) {
head.dirty = true;
!rm && normalizeQueue.add(_i);
hooks.callHook("entries:updated", head);
},
dispose() {
if (entries.delete(_i)) {
head.invalidate();
}
},
// a patch is the same as creating a new entry, just a nice DX
patch(input2) {
if (!options.mode || options.mode === "server" && ssr || options.mode === "client" && !ssr) {
inst.input = input2;
entries.set(_i, inst);
_._poll();
}
}
};
_.patch(input);
return _;
},
async resolveTags() {
const ctx = {
tagMap: /* @__PURE__ */ new Map(),
tags: [],
entries: [...head.entries.values()]
};
await hooks.callHook("entries:resolve", ctx);
while (normalizeQueue.size) {
const i = normalizeQueue.values().next().value;
normalizeQueue.delete(i);
const e = entries.get(i);
if (e) {
const normalizeCtx = {
tags: normalizeEntryToTags(e.input, resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)),
entry: e
};
await hooks.callHook("entries:normalize", normalizeCtx);
e._tags = normalizeCtx.tags.map((t, i2) => {
t._w = tagWeight(head, t);
t._p = (e._i << 10) + i2;
t._d = dedupeKey(t);
return t;
});
}
}
let hasFlatMeta = false;
ctx.entries.flatMap((e) => (e._tags || []).map((t) => ({ ...t, props: { ...t.props } }))).sort(sortTags).reduce((acc, next) => {
const k = String(next._d || next._p);
if (!acc.has(k))
return acc.set(k, next);
const prev = acc.get(k);
const strategy = next?.tagDuplicateStrategy || (UsesMergeStrategy.has(next.tag) ? "merge" : null) || (next.key && next.key === prev.key ? "merge" : null);
if (strategy === "merge") {
const newProps = { ...prev.props };
Object.entries(next.props).forEach(([p, v]) => (
// @ts-expect-error untyped
newProps[p] = p === "style" ? new Map([...prev.props.style || /* @__PURE__ */ new Map(), ...v]) : p === "class" ? /* @__PURE__ */ new Set([...prev.props.class || /* @__PURE__ */ new Set(), ...v]) : v
));
acc.set(k, { ...next, props: newProps });
} else if (next._p >> 10 === prev._p >> 10 && next.tag === "meta" && isMetaArrayDupeKey(k)) {
acc.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next));
hasFlatMeta = true;
} else if (next._w === prev._w ? next._p > prev._p : next?._w < prev?._w) {
acc.set(k, next);
}
return acc;
}, ctx.tagMap);
const title = ctx.tagMap.get("title");
const titleTemplate = ctx.tagMap.get("titleTemplate");
head._title = title?.textContent;
if (titleTemplate) {
const titleTemplateFn = titleTemplate?.textContent;
head._titleTemplate = titleTemplateFn;
if (titleTemplateFn) {
let newTitle = typeof titleTemplateFn === "function" ? titleTemplateFn(title?.textContent) : titleTemplateFn;
if (typeof newTitle === "string" && !head.plugins.has("template-params")) {
newTitle = newTitle.replace("%s", title?.textContent || "");
}
if (title) {
newTitle === null ? ctx.tagMap.delete("title") : ctx.tagMap.set("title", { ...title, textContent: newTitle });
} else {
titleTemplate.tag = "title";
titleTemplate.textContent = newTitle;
}
}
}
ctx.tags = Array.from(ctx.tagMap.values());
if (hasFlatMeta) {
ctx.tags = ctx.tags.flat().sort(sortTags);
}
await hooks.callHook("tags:beforeResolve", ctx);
await hooks.callHook("tags:resolve", ctx);
await hooks.callHook("tags:afterResolve", ctx);
const finalTags = [];
for (const t of ctx.tags) {
const { innerHTML, tag, props } = t;
if (!ValidHeadTags.has(tag)) {
continue;
}
if (Object.keys(props).length === 0 && !t.innerHTML && !t.textContent) {
continue;
}
if (tag === "meta" && !props.content && !props["http-equiv"] && !props.charset) {
continue;
}
if (tag === "script" && innerHTML) {
if (String(props.type).endsWith("json")) {
const v = typeof innerHTML === "string" ? innerHTML : JSON.stringify(innerHTML);
t.innerHTML = v.replace(/</g, "\\u003C");
} else if (typeof innerHTML === "string") {
t.innerHTML = innerHTML.replace(new RegExp(`</${tag}`, "g"), `<\\/${tag}`);
}
t._d = dedupeKey(t);
}
finalTags.push(t);
}
return finalTags;
},
invalidate() {
for (const entry of entries.values()) {
normalizeQueue.add(entry._i);
}
head.dirty = true;
hooks.callHook("entries:updated", head);
}
};
(resolvedOptions?.plugins || []).forEach((p) => registerPlugin(head, p));
head.hooks.callHook("init", head);
resolvedOptions.init?.forEach((e) => e && head.push(e));
return head;
}
export { createUnhead as a, createHeadCore as c };

View File

@@ -0,0 +1,44 @@
import { S as SafeInputPlugin, F as FlatMetaPlugin } from './unhead.CApf5sj3.mjs';
function useHead(unhead, input, options = {}) {
return unhead.push(input || {}, options);
}
function useHeadSafe(unhead, input = {}, options = {}) {
unhead.use(SafeInputPlugin);
return useHead(unhead, input, Object.assign(options, { _safe: true }));
}
function useSeoMeta(unhead, input = {}, options) {
unhead.use(FlatMetaPlugin);
function normalize(input2) {
if (input2._flatMeta) {
return input2;
}
const { title, titleTemplate, ...meta } = input2 || {};
return {
title,
titleTemplate,
_flatMeta: meta
};
}
const entry = unhead.push(normalize(input), options);
const corePatch = entry.patch;
if (!entry.__patched) {
entry.patch = (input2) => corePatch(normalize(input2));
entry.__patched = true;
}
return entry;
}
function useServerHead(unhead, input = {}, options = {}) {
options.mode = "server";
return unhead.push(input, options);
}
function useServerHeadSafe(unhead, input = {}, options = {}) {
options.mode = "server";
return useHeadSafe(unhead, input, { ...options, mode: "server" });
}
function useServerSeoMeta(unhead, input = {}, options) {
options.mode = "server";
return useSeoMeta(unhead, input, { ...options, mode: "server" });
}
export { useHeadSafe as a, useSeoMeta as b, useServerHead as c, useServerHeadSafe as d, useServerSeoMeta as e, useHead as u };

View File

@@ -0,0 +1,43 @@
const SepSub = "%separator";
function sub(p, token, isJson = false) {
let val;
if (token === "s" || token === "pageTitle") {
val = p.pageTitle;
} else if (token.includes(".")) {
const dotIndex = token.indexOf(".");
val = p[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
} else {
val = p[token];
}
if (val !== void 0) {
return isJson ? (val || "").replace(/\\/g, "\\\\").replace(/</g, "\\u003C").replace(/"/g, '\\"') : val || "";
}
return void 0;
}
function processTemplateParams(s, p, sep, isJson = false) {
if (typeof s !== "string" || !s.includes("%"))
return s;
let decoded = s;
try {
decoded = decodeURI(s);
} catch {
}
const tokens = decoded.match(/%\w+(?:\.\w+)?/g);
if (!tokens) {
return s;
}
const hasSepSub = s.includes(SepSub);
s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
if (token === SepSub || !tokens.includes(token)) {
return token;
}
const re = sub(p, token.slice(1), isJson);
return re !== void 0 ? re : token;
}).trim();
if (hasSepSub) {
s = s.split(SepSub).map((part) => part.trim()).filter((part) => part !== "").join(sep ? ` ${sep} ` : " ");
}
return s;
}
export { processTemplateParams as p };

View File

@@ -0,0 +1,148 @@
import { u as unpackMeta } from './unhead.DQc16pHI.mjs';
function defineHeadPlugin(plugin) {
return plugin;
}
const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
key: "flatMeta",
hooks: {
"entries:normalize": (ctx) => {
const tagsToAdd = [];
ctx.tags = ctx.tags.map((t) => {
if (t.tag !== "_flatMeta") {
return t;
}
tagsToAdd.push(unpackMeta(t.props).map((p) => ({
...t,
tag: "meta",
props: p
})));
return false;
}).filter(Boolean).concat(...tagsToAdd);
}
}
});
const WhitelistAttributes = {
htmlAttrs: /* @__PURE__ */ new Set(["class", "style", "lang", "dir"]),
bodyAttrs: /* @__PURE__ */ new Set(["class", "style"]),
meta: /* @__PURE__ */ new Set(["name", "property", "charset", "content", "media"]),
noscript: /* @__PURE__ */ new Set(["textContent"]),
style: /* @__PURE__ */ new Set(["media", "textContent", "nonce", "title", "blocking"]),
script: /* @__PURE__ */ new Set(["type", "textContent", "nonce", "blocking"]),
link: /* @__PURE__ */ new Set(["color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"])
};
function acceptDataAttrs(value) {
return Object.fromEntries(
Object.entries(value || {}).filter(([key]) => key === "id" || key.startsWith("data-"))
);
}
function makeTagSafe(tag) {
let next = {};
const { tag: type, props: prev } = tag;
switch (type) {
// always safe
case "title":
case "titleTemplate":
case "templateParams":
next = prev;
break;
case "htmlAttrs":
case "bodyAttrs":
WhitelistAttributes[type].forEach((attr) => {
if (prev[attr]) {
next[attr] = prev[attr];
}
});
break;
case "style":
next = acceptDataAttrs(prev);
WhitelistAttributes.style.forEach((key) => {
if (prev[key]) {
next[key] = prev[key];
}
});
break;
// meta is safe, except for http-equiv
case "meta":
WhitelistAttributes.meta.forEach((key) => {
if (prev[key]) {
next[key] = prev[key];
}
});
break;
// link tags we don't allow stylesheets, scripts, preloading, prerendering, prefetching, etc
case "link":
WhitelistAttributes.link.forEach((key) => {
const val = prev[key];
if (!val) {
return;
}
if (key === "rel" && (val === "canonical" || val === "modulepreload" || val === "prerender" || val === "preload" || val === "prefetch")) {
return;
}
if (key === "href") {
if (val.includes("javascript:") || val.includes("data:")) {
return;
}
next[key] = val;
} else if (val) {
next[key] = val;
}
});
if (!next.href && !next.imagesrcset || !next.rel) {
return false;
}
break;
case "noscript":
WhitelistAttributes.noscript.forEach((key) => {
if (prev[key]) {
next[key] = prev[key];
}
});
break;
// we only allow JSON in scripts
case "script":
if (!tag.textContent || !prev.type?.endsWith("json")) {
return false;
}
WhitelistAttributes.script.forEach((s) => {
if (prev[s] === "textContent") {
try {
const jsonVal = typeof prev[s] === "string" ? JSON.parse(prev[s]) : prev[s];
next[s] = JSON.stringify(jsonVal, null, 0);
} catch {
}
} else if (prev[s]) {
next[s] = prev[s];
}
});
break;
}
if (!Object.keys(next).length && !tag.tag.endsWith("Attrs")) {
return false;
}
tag.props = { ...acceptDataAttrs(prev), ...next };
return tag;
}
const SafeInputPlugin = (
/* @PURE */
defineHeadPlugin({
key: "safe",
hooks: {
"entries:normalize": (ctx) => {
if (ctx.entry.options?._safe) {
ctx.tags = ctx.tags.reduce((acc, tag) => {
const safeTag = makeTagSafe(tag);
if (safeTag)
acc.push(safeTag);
return acc;
}, []);
}
}
}
})
);
export { FlatMetaPlugin as F, SafeInputPlugin as S, defineHeadPlugin as d };

View File

@@ -0,0 +1,71 @@
const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
const TAG_WEIGHTS = {
base: -10,
title: 10
};
const TAG_ALIASES = {
critical: -8,
high: -1,
low: 2
};
const WEIGHT_MAP = {
meta: {
"content-security-policy": -30,
"charset": -20,
"viewport": -15
},
link: {
"preconnect": 20,
"stylesheet": 60,
"preload": 70,
"modulepreload": 70,
"prefetch": 90,
"dns-prefetch": 90,
"prerender": 90
},
script: {
async: 30,
defer: 80,
sync: 50
},
style: {
imported: 40,
sync: 60
}
};
const ImportStyleRe = /@import/;
const isTruthy = (val) => val === "" || val === true;
function tagWeight(head, tag) {
if (typeof tag.tagPriority === "number")
return tag.tagPriority;
let weight = 100;
const offset = TAG_ALIASES[tag.tagPriority] || 0;
const weightMap = head.resolvedOptions.disableCapoSorting ? {
link: {},
script: {},
style: {}
} : WEIGHT_MAP;
if (tag.tag in TAG_WEIGHTS) {
weight = TAG_WEIGHTS[tag.tag];
} else if (tag.tag === "meta") {
const metaType = tag.props["http-equiv"] === "content-security-policy" ? "content-security-policy" : tag.props.charset ? "charset" : tag.props.name === "viewport" ? "viewport" : null;
if (metaType)
weight = WEIGHT_MAP.meta[metaType];
} else if (tag.tag === "link" && tag.props.rel) {
weight = weightMap.link[tag.props.rel];
} else if (tag.tag === "script") {
const type = String(tag.props.type);
if (isTruthy(tag.props.async)) {
weight = weightMap.script.async;
} else if (tag.props.src && !isTruthy(tag.props.defer) && !isTruthy(tag.props.async) && type !== "module" && !type.endsWith("json") || tag.innerHTML && !type.endsWith("json")) {
weight = weightMap.script.sync;
} else if (isTruthy(tag.props.defer) && tag.props.src && !isTruthy(tag.props.async) || type === "module") {
weight = weightMap.script.defer;
}
} else if (tag.tag === "style") {
weight = tag.innerHTML && ImportStyleRe.test(tag.innerHTML) ? weightMap.style.imported : weightMap.style.sync;
}
return (weight || 100) + offset;
}
export { sortTags as s, tagWeight as t };

View File

@@ -0,0 +1,196 @@
import { M as MetaTagsArrayable } from './unhead.yem5I2v_.mjs';
const NAMESPACES = {
META: /* @__PURE__ */ new Set(["twitter"]),
OG: /* @__PURE__ */ new Set(["og", "book", "article", "profile", "fb"]),
MEDIA: /* @__PURE__ */ new Set(["ogImage", "ogVideo", "ogAudio", "twitterImage"]),
HTTP_EQUIV: /* @__PURE__ */ new Set(["contentType", "defaultStyle", "xUaCompatible"])
};
const META_ALIASES = {
articleExpirationTime: "article:expiration_time",
articleModifiedTime: "article:modified_time",
articlePublishedTime: "article:published_time",
bookReleaseDate: "book:release_date",
fbAppId: "fb:app_id",
ogAudioSecureUrl: "og:audio:secure_url",
ogAudioUrl: "og:audio",
ogImageSecureUrl: "og:image:secure_url",
ogImageUrl: "og:image",
ogSiteName: "og:site_name",
ogVideoSecureUrl: "og:video:secure_url",
ogVideoUrl: "og:video",
profileFirstName: "profile:first_name",
profileLastName: "profile:last_name",
profileUsername: "profile:username",
msapplicationConfig: "msapplication-Config",
msapplicationTileColor: "msapplication-TileColor",
msapplicationTileImage: "msapplication-TileImage"
};
const MetaPackingSchema = {
appleItunesApp: {
unpack: {
entrySeparator: ", ",
// @ts-expect-error untyped
resolve: ({ key, value }) => `${fixKeyCase(key)}=${value}`
}
},
refresh: {
metaKey: "http-equiv",
unpack: {
entrySeparator: ";",
// @ts-expect-error untyped
resolve: ({ key, value }) => key === "seconds" ? `${value}` : void 0
}
},
robots: {
unpack: {
entrySeparator: ", ",
// @ts-expect-error untyped
resolve: ({ key, value }) => typeof value === "boolean" ? fixKeyCase(key) : `${fixKeyCase(key)}:${value}`
}
},
contentSecurityPolicy: {
metaKey: "http-equiv",
unpack: {
entrySeparator: "; ",
// @ts-expect-error untyped
resolve: ({ key, value }) => `${fixKeyCase(key)} ${value}`
}
},
charset: {}
};
function fixKeyCase(key) {
const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase();
const prefixIndex = updated.indexOf("-");
return prefixIndex === -1 ? updated : NAMESPACES.META.has(updated.slice(0, prefixIndex)) || NAMESPACES.OG.has(updated.slice(0, prefixIndex)) ? key.replace(/([A-Z])/g, ":$1").toLowerCase() : updated;
}
function sanitizeObject(input) {
return Object.fromEntries(Object.entries(input).filter(([k, v]) => String(v) !== "false" && k));
}
function transformObject(obj) {
return Array.isArray(obj) ? obj.map(transformObject) : !obj || typeof obj !== "object" ? obj : Object.fromEntries(Object.entries(obj).map(([k, v]) => [fixKeyCase(k), transformObject(v)]));
}
function unpackToString(value, options = {}) {
const { entrySeparator = "", keyValueSeparator = "", wrapValue, resolve } = options;
return Object.entries(value).map(([key, val]) => {
if (resolve) {
const resolved = resolve({ key, value: val });
if (resolved !== void 0)
return resolved;
}
const processedVal = typeof val === "object" ? unpackToString(val, options) : typeof val === "number" ? val.toString() : typeof val === "string" && wrapValue ? `${wrapValue}${val.replace(new RegExp(wrapValue, "g"), `\\${wrapValue}`)}${wrapValue}` : val;
return `${key}${keyValueSeparator}${processedVal}`;
}).join(entrySeparator);
}
function handleObjectEntry(key, value) {
const sanitizedValue = sanitizeObject(value);
const fixedKey = fixKeyCase(key);
const attr = resolveMetaKeyType(fixedKey);
if (!MetaTagsArrayable.has(fixedKey)) {
return [{ [attr]: fixedKey, ...sanitizedValue }];
}
const input = Object.fromEntries(
Object.entries(sanitizedValue).map(([k, v]) => [`${key}${k === "url" ? "" : `${k[0].toUpperCase()}${k.slice(1)}`}`, v])
);
return unpackMeta(input || {}).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
}
function resolveMetaKeyType(key) {
if (MetaPackingSchema[key]?.metaKey === "http-equiv" || NAMESPACES.HTTP_EQUIV.has(key)) {
return "http-equiv";
}
const fixed = fixKeyCase(key);
const colonIndex = fixed.indexOf(":");
return colonIndex === -1 ? "name" : NAMESPACES.OG.has(fixed.slice(0, colonIndex)) ? "property" : "name";
}
function resolveMetaKeyValue(key) {
return META_ALIASES[key] || fixKeyCase(key);
}
function resolvePackedMetaObjectValue(value, key) {
if (key === "refresh")
return `${value.seconds};url=${value.url}`;
return unpackToString(transformObject(value), {
keyValueSeparator: "=",
entrySeparator: ", ",
resolve: ({ value: value2, key: key2 }) => value2 === null ? "" : typeof value2 === "boolean" ? key2 : void 0,
// @ts-expect-error untyped
...MetaPackingSchema[key]?.unpack
});
}
function unpackMeta(input) {
const extras = [];
const primitives = {};
for (const [key, value] of Object.entries(input)) {
if (Array.isArray(value)) {
if (key === "themeColor") {
value.forEach((v) => {
if (typeof v === "object" && v !== null) {
extras.push({ name: "theme-color", ...v });
}
});
continue;
}
for (const v of value) {
if (typeof v === "object" && v !== null) {
const urlProps = [];
const otherProps = [];
for (const [propKey, propValue] of Object.entries(v)) {
const metaKey = `${key}${propKey === "url" ? "" : `:${propKey}`}`;
const meta2 = unpackMeta({ [metaKey]: propValue });
(propKey === "url" ? urlProps : otherProps).push(...meta2);
}
extras.push(...urlProps, ...otherProps);
} else {
extras.push(...typeof v === "string" ? unpackMeta({ [key]: v }) : handleObjectEntry(key, v));
}
}
continue;
}
if (typeof value === "object" && value) {
if (NAMESPACES.MEDIA.has(key)) {
const prefix = key.startsWith("twitter") ? "twitter" : "og";
const type = key.replace(/^(og|twitter)/, "").toLowerCase();
const metaKey = prefix === "twitter" ? "name" : "property";
if (value.url) {
extras.push({
[metaKey]: `${prefix}:${type}`,
content: value.url
});
}
if (value.secureUrl) {
extras.push({
[metaKey]: `${prefix}:${type}:secure_url`,
content: value.secureUrl
});
}
for (const [propKey, propValue] of Object.entries(value)) {
if (propKey !== "url" && propKey !== "secureUrl") {
extras.push({
[metaKey]: `${prefix}:${type}:${propKey}`,
// @ts-expect-error untyped
content: propValue
});
}
}
} else if (MetaTagsArrayable.has(fixKeyCase(key))) {
extras.push(...handleObjectEntry(key, value));
} else {
primitives[key] = sanitizeObject(value);
}
} else {
primitives[key] = value;
}
}
const meta = Object.entries(primitives).map(([key, value]) => {
if (key === "charset")
return { charset: value === null ? "_null" : value };
const metaKey = resolveMetaKeyType(key);
const keyValue = resolveMetaKeyValue(key);
const processedValue = value === null ? "_null" : typeof value === "object" ? resolvePackedMetaObjectValue(value, key) : typeof value === "number" ? value.toString() : value;
return metaKey === "http-equiv" ? { "http-equiv": keyValue, "content": processedValue } : { [metaKey]: keyValue, content: processedValue };
});
return [...extras, ...meta].map(
(m) => !("content" in m) ? m : m.content === "_null" ? { ...m, content: null } : m
);
}
export { resolveMetaKeyValue as a, resolvePackedMetaObjectValue as b, resolveMetaKeyType as r, unpackMeta as u };

View File

@@ -0,0 +1,166 @@
import { d as defineHeadPlugin } from './unhead.CApf5sj3.mjs';
import { s as sortTags } from './unhead.CbpEuj3y.mjs';
import { p as processTemplateParams } from './unhead.BYvz9V1x.mjs';
const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
const AliasSortingPlugin = defineHeadPlugin({
key: "aliasSorting",
hooks: {
"tags:resolve": (ctx) => {
let m = false;
for (const t of ctx.tags) {
const p = t.tagPriority;
if (!p)
continue;
const s = String(p);
if (s.startsWith("before:")) {
const k = formatKey(s.slice(7));
const l = ctx.tagMap.get(k);
if (l) {
if (typeof l.tagPriority === "number")
t.tagPriority = l.tagPriority;
t._p = l._p - 1;
m = true;
}
} else if (s.startsWith("after:")) {
const k = formatKey(s.slice(6));
const l = ctx.tagMap.get(k);
if (l) {
if (typeof l.tagPriority === "number")
t.tagPriority = l.tagPriority;
t._p = l._p + 1;
m = true;
}
}
}
if (m)
ctx.tags = ctx.tags.sort(sortTags);
}
}
});
const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({
key: "deprecations",
hooks: {
"entries:normalize": ({ tags }) => {
for (const tag of tags) {
if (tag.props.children) {
tag.innerHTML = tag.props.children;
delete tag.props.children;
}
if (tag.props.hid) {
tag.key = tag.props.hid;
delete tag.props.hid;
}
if (tag.props.vmid) {
tag.key = tag.props.vmid;
delete tag.props.vmid;
}
if (tag.props.body) {
tag.tagPosition = "bodyClose";
delete tag.props.body;
}
}
}
}
});
async function walkPromises(v) {
const type = typeof v;
if (type === "function") {
return v;
}
if (v instanceof Promise) {
return await v;
}
if (Array.isArray(v)) {
return await Promise.all(v.map((r) => walkPromises(r)));
}
if (v?.constructor === Object) {
const next = {};
for (const key of Object.keys(v)) {
next[key] = await walkPromises(v[key]);
}
return next;
}
return v;
}
const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
key: "promises",
hooks: {
"entries:resolve": async (ctx) => {
const promises = [];
for (const k in ctx.entries) {
if (!ctx.entries[k]._promisesProcessed) {
promises.push(
walkPromises(ctx.entries[k].input).then((val) => {
ctx.entries[k].input = val;
ctx.entries[k]._promisesProcessed = true;
})
);
}
}
await Promise.all(promises);
}
}
});
const SupportedAttrs = {
meta: "content",
link: "href",
htmlAttrs: "lang"
};
const contentAttrs = ["innerHTML", "textContent"];
const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => {
return {
key: "template-params",
hooks: {
"entries:normalize": (ctx) => {
const params = ctx.tags.filter((t) => t.tag === "templateParams" && t.mode === "server")?.[0]?.props || {};
if (Object.keys(params).length) {
head._ssrPayload = {
templateParams: {
...head._ssrPayload?.templateParams || {},
...params
}
};
}
},
"tags:resolve": ({ tagMap, tags }) => {
const params = tagMap.get("templateParams")?.props || {};
const sep = params.separator || "|";
delete params.separator;
params.pageTitle = processTemplateParams(
// find templateParams
params.pageTitle || head._title || "",
params,
sep
);
for (const tag of tags) {
if (tag.processTemplateParams === false) {
continue;
}
const v = SupportedAttrs[tag.tag];
if (v && typeof tag.props[v] === "string") {
tag.props[v] = processTemplateParams(tag.props[v], params, sep);
} else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
for (const p of contentAttrs) {
if (typeof tag[p] === "string")
tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
}
}
}
head._templateParams = params;
head._separator = sep;
},
"tags:afterResolve": ({ tagMap }) => {
const title = tagMap.get("title");
if (title?.textContent && title.processTemplateParams !== false) {
title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
}
}
}
};
});
export { AliasSortingPlugin as A, DeprecationsPlugin as D, PromisesPlugin as P, TemplateParamsPlugin as T };

View File

@@ -0,0 +1,198 @@
import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
const allowedMetaProperties = ["name", "property", "http-equiv"];
const StandardSingleMetaTags = /* @__PURE__ */ new Set([
"viewport",
"description",
"keywords",
"robots"
]);
function isMetaArrayDupeKey(v) {
const parts = v.split(":");
if (!parts.length)
return false;
return MetaTagsArrayable.has(parts[1]);
}
function dedupeKey(tag) {
const { props, tag: name } = tag;
if (UniqueTags.has(name))
return name;
if (name === "link" && props.rel === "canonical")
return "canonical";
const altKey = props.hreflang || props.type;
if (name === "link" && props.rel === "alternate" && altKey) {
return `alternate:${altKey}`;
}
if (props.charset)
return "charset";
if (tag.tag === "meta") {
for (const n of allowedMetaProperties) {
if (props[n] !== void 0) {
const propValue = props[n];
const isStructured = propValue && typeof propValue === "string" && propValue.includes(":");
const isStandardSingle = propValue && StandardSingleMetaTags.has(propValue);
const shouldAlwaysDedupe = isStructured || isStandardSingle;
const keyPart = !shouldAlwaysDedupe && tag.key ? `:key:${tag.key}` : "";
return `${name}:${propValue}${keyPart}`;
}
}
}
if (tag.key) {
return `${name}:key:${tag.key}`;
}
if (props.id) {
return `${name}:id:${props.id}`;
}
if (TagsWithInnerContent.has(name)) {
const v = tag.textContent || tag.innerHTML;
if (v) {
return `${name}:content:${v}`;
}
}
}
function hashTag(tag) {
const dedupe = tag._h || tag._d;
if (dedupe)
return dedupe;
const inner = tag.textContent || tag.innerHTML;
if (inner)
return inner;
return `${tag.tag}:${Object.entries(tag.props).map(([k, v]) => `${k}:${String(v)}`).join(",")}`;
}
function walkResolver(val, resolve, key) {
const type = typeof val;
if (type === "function") {
if (!key || key !== "titleTemplate" && !(key[0] === "o" && key[1] === "n")) {
val = val();
}
}
const v = resolve ? resolve(key, val) : val;
if (Array.isArray(v)) {
return v.map((r) => walkResolver(r, resolve));
}
if (v?.constructor === Object) {
const next = {};
for (const k of Object.keys(v)) {
next[k] = walkResolver(v[k], resolve, k);
}
return next;
}
return v;
}
function normalizeStyleClassProps(key, value) {
const store = key === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
function processValue(rawValue) {
if (rawValue == null || rawValue === void 0)
return;
const value2 = String(rawValue).trim();
if (!value2)
return;
if (key === "style") {
const [k, ...v] = value2.split(":").map((s) => s ? s.trim() : "");
if (k && v.length)
store.set(k, v.join(":"));
} else {
value2.split(" ").filter(Boolean).forEach((c) => store.add(c));
}
}
if (typeof value === "string") {
key === "style" ? value.split(";").forEach(processValue) : processValue(value);
} else if (Array.isArray(value)) {
value.forEach((item) => processValue(item));
} else if (value && typeof value === "object") {
Object.entries(value).forEach(([k, v]) => {
if (v && v !== "false") {
key === "style" ? store.set(String(k).trim(), String(v)) : processValue(k);
}
});
}
return store;
}
function normalizeProps(tag, input) {
tag.props = tag.props || {};
if (!input) {
return tag;
}
if (tag.tag === "templateParams") {
tag.props = input;
return tag;
}
Object.entries(input).forEach(([key, value]) => {
if (value === null) {
tag.props[key] = null;
return;
}
if (key === "class" || key === "style") {
tag.props[key] = normalizeStyleClassProps(key, value);
return;
}
if (TagConfigKeys.has(key)) {
if (["textContent", "innerHTML"].includes(key) && typeof value === "object") {
let type = input.type;
if (!input.type) {
type = "application/json";
}
if (!type?.endsWith("json") && type !== "speculationrules") {
return;
}
input.type = type;
tag.props.type = type;
tag[key] = JSON.stringify(value);
} else {
tag[key] = value;
}
return;
}
const strValue = String(value);
const isDataKey = key.startsWith("data-");
const isMetaContentKey = tag.tag === "meta" && key === "content";
if (strValue === "true" || strValue === "") {
tag.props[key] = isDataKey || isMetaContentKey ? strValue : true;
} else if (!value && isDataKey && strValue === "false") {
tag.props[key] = "false";
} else if (value !== void 0) {
tag.props[key] = value;
}
});
return tag;
}
function normalizeTag(tagName, _input) {
const input = typeof _input === "object" && typeof _input !== "function" ? _input : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: _input };
const tag = normalizeProps({ tag: tagName, props: {} }, input);
if (tag.key && DupeableTags.has(tag.tag)) {
tag.props["data-hid"] = tag._h = tag.key;
}
if (tag.tag === "script" && typeof tag.innerHTML === "object") {
tag.innerHTML = JSON.stringify(tag.innerHTML);
tag.props.type = tag.props.type || "application/json";
}
return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag;
}
function normalizeEntryToTags(input, propResolvers) {
if (!input) {
return [];
}
if (typeof input === "function") {
input = input();
}
const resolvers = (key, val) => {
for (let i = 0; i < propResolvers.length; i++) {
val = propResolvers[i](key, val);
}
return val;
};
input = resolvers(void 0, input);
const tags = [];
input = walkResolver(input, resolvers);
Object.entries(input || {}).forEach(([key, value]) => {
if (value === void 0)
return;
for (const v of Array.isArray(value) ? value : [value])
tags.push(normalizeTag(key, v));
});
return tags.flat();
}
export { normalizeProps as a, dedupeKey as d, hashTag as h, isMetaArrayDupeKey as i, normalizeEntryToTags as n, walkResolver as w };

View File

@@ -0,0 +1,38 @@
const SelfClosingTags = /* @__PURE__ */ new Set(["meta", "link", "base"]);
const DupeableTags = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]);
const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]);
const HasElementTags = /* @__PURE__ */ new Set([
"base",
"meta",
"link",
"style",
"script",
"noscript"
]);
const ValidHeadTags = /* @__PURE__ */ new Set([
"title",
"base",
"htmlAttrs",
"bodyAttrs",
"meta",
"link",
"style",
"script",
"noscript"
]);
const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]);
const TagConfigKeys = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]);
const ScriptNetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror"]);
const UsesMergeStrategy = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]);
const MetaTagsArrayable = /* @__PURE__ */ new Set([
"theme-color",
"google-site-verification",
"og",
"article",
"book",
"profile",
"twitter",
"author"
]);
export { DupeableTags as D, HasElementTags as H, MetaTagsArrayable as M, SelfClosingTags as S, TagsWithInnerContent as T, UniqueTags as U, ValidHeadTags as V, TagConfigKeys as a, ScriptNetworkEvents as b, UsesMergeStrategy as c };

5
.output/server/node_modules/unhead/dist/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, b as ScriptNetworkEvents, S as SelfClosingTags, a as TagConfigKeys, T as TagsWithInnerContent, U as UniqueTags, c as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.yem5I2v_.mjs';
export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.eK9_7LaY.mjs';
export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.DQc16pHI.mjs';
export { s as sortTags, t as tagWeight } from './shared/unhead.CbpEuj3y.mjs';
export { p as processTemplateParams } from './shared/unhead.BYvz9V1x.mjs';

105
.output/server/node_modules/unhead/package.json generated vendored Normal file
View File

@@ -0,0 +1,105 @@
{
"name": "unhead",
"type": "module",
"version": "2.1.4",
"description": "Full-stack <head> manager built for any framework.",
"author": {
"name": "Harlan Wilton",
"email": "harlan@harlanzw.com",
"url": "https://harlanzw.com/"
},
"publishConfig": {
"access": "public",
"tag": "next"
},
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://unhead.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unhead.git",
"directory": "packages/unhead"
},
"bugs": {
"url": "https://github.com/unjs/unhead/issues"
},
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"./plugins": {
"types": "./dist/plugins.d.ts",
"default": "./dist/plugins.mjs"
},
"./server": {
"types": "./dist/server.d.ts",
"default": "./dist/server.mjs"
},
"./client": {
"types": "./dist/client.d.ts",
"default": "./dist/client.mjs"
},
"./legacy": {
"types": "./dist/legacy.d.ts",
"default": "./dist/legacy.mjs"
},
"./utils": {
"types": "./dist/utils.d.ts",
"default": "./dist/utils.mjs"
},
"./types": {
"types": "./dist/types.d.ts",
"default": "./dist/types.mjs"
},
"./scripts": {
"types": "./dist/scripts.d.ts",
"default": "./dist/scripts.mjs"
},
"./parser": {
"types": "./dist/parser.d.ts",
"default": "./dist/parser.mjs"
}
},
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"optionalPlugins": {
"*": {
"plugins": [
"dist/plugins"
],
"server": [
"dist/server"
],
"client": [
"dist/client"
],
"legacy": [
"dist/legacy"
],
"types": [
"dist/types"
],
"utils": [
"dist/utils"
],
"scripts": [
"dist/scripts"
]
}
},
"files": [
"*.d.ts",
"dist"
],
"dependencies": {
"hookable": "^6.0.1"
},
"scripts": {
"build": "unbuild",
"stub": "unbuild --stub",
"test:attw": "attw --pack"
}
}

View File

@@ -0,0 +1,301 @@
import { withLeadingSlash } from 'ufo';
function createRendererContext({ manifest, precomputed, buildAssetsURL }) {
if (!manifest && !precomputed) {
throw new Error("Either manifest or precomputed data must be provided");
}
const ctx = {
// Options
buildAssetsURL: buildAssetsURL || withLeadingSlash,
manifest,
precomputed,
updateManifest,
// Internal cache
_dependencies: {},
_dependencySets: {},
_entrypoints: []
};
function updateManifest(manifest2) {
const manifestEntries = Object.entries(manifest2);
ctx.manifest = manifest2;
ctx._dependencies = {};
ctx._dependencySets = {};
ctx._entrypoints = manifestEntries.filter((e) => e[1].isEntry).map(([module]) => module);
}
if (precomputed) {
ctx._dependencies = precomputed.dependencies;
ctx._entrypoints = precomputed.entrypoints;
} else if (manifest) {
updateManifest(manifest);
}
return ctx;
}
function getModuleDependencies(id, rendererContext) {
if (rendererContext._dependencies[id]) {
return rendererContext._dependencies[id];
}
const dependencies = rendererContext._dependencies[id] = {
scripts: {},
styles: {},
preload: {},
prefetch: {}
};
if (!rendererContext.manifest) {
return dependencies;
}
const meta = rendererContext.manifest[id];
if (!meta) {
return dependencies;
}
if (meta.file) {
dependencies.preload[id] = meta;
if (meta.isEntry || meta.sideEffects) {
dependencies.scripts[id] = meta;
}
}
for (const css of meta.css || []) {
dependencies.styles[css] = dependencies.preload[css] = dependencies.prefetch[css] = rendererContext.manifest[css];
}
for (const asset of meta.assets || []) {
dependencies.preload[asset] = dependencies.prefetch[asset] = rendererContext.manifest[asset];
}
for (const depId of meta.imports || []) {
const depDeps = getModuleDependencies(depId, rendererContext);
for (const key in depDeps.styles) {
dependencies.styles[key] = depDeps.styles[key];
}
for (const key in depDeps.preload) {
dependencies.preload[key] = depDeps.preload[key];
}
for (const key in depDeps.prefetch) {
dependencies.prefetch[key] = depDeps.prefetch[key];
}
}
const filteredPreload = {};
for (const id2 in dependencies.preload) {
const dep = dependencies.preload[id2];
if (dep.preload) {
filteredPreload[id2] = dep;
}
}
dependencies.preload = filteredPreload;
return dependencies;
}
function getAllDependencies(ids, rendererContext) {
let cacheKey = "";
const sortedIds = [...ids].sort();
for (let i = 0; i < sortedIds.length; i++) {
if (i > 0) cacheKey += ",";
cacheKey += sortedIds[i];
}
if (rendererContext._dependencySets[cacheKey]) {
return rendererContext._dependencySets[cacheKey];
}
const allDeps = {
scripts: {},
styles: {},
preload: {},
prefetch: {}
};
for (const id of ids) {
const deps = getModuleDependencies(id, rendererContext);
for (const key in deps.scripts) {
allDeps.scripts[key] = deps.scripts[key];
}
for (const key in deps.styles) {
allDeps.styles[key] = deps.styles[key];
}
for (const key in deps.preload) {
allDeps.preload[key] = deps.preload[key];
}
for (const key in deps.prefetch) {
allDeps.prefetch[key] = deps.prefetch[key];
}
for (const dynamicDepId of rendererContext.manifest?.[id]?.dynamicImports || []) {
const dynamicDeps = getModuleDependencies(dynamicDepId, rendererContext);
for (const key in dynamicDeps.scripts) {
allDeps.prefetch[key] = dynamicDeps.scripts[key];
}
for (const key in dynamicDeps.styles) {
allDeps.prefetch[key] = dynamicDeps.styles[key];
}
for (const key in dynamicDeps.preload) {
allDeps.prefetch[key] = dynamicDeps.preload[key];
}
}
}
const filteredPrefetch = {};
for (const id in allDeps.prefetch) {
const dep = allDeps.prefetch[id];
if (dep.prefetch) {
filteredPrefetch[id] = dep;
}
}
allDeps.prefetch = filteredPrefetch;
for (const id in allDeps.preload) {
delete allDeps.prefetch[id];
}
for (const style in allDeps.styles) {
delete allDeps.preload[style];
delete allDeps.prefetch[style];
}
rendererContext._dependencySets[cacheKey] = allDeps;
return allDeps;
}
function getRequestDependencies(ssrContext, rendererContext) {
if (ssrContext._requestDependencies) {
return ssrContext._requestDependencies;
}
const ids = new Set(Array.from([
...rendererContext._entrypoints,
...ssrContext.modules || ssrContext._registeredComponents || []
]));
const deps = getAllDependencies(ids, rendererContext);
ssrContext._requestDependencies = deps;
return deps;
}
function renderStyles(ssrContext, rendererContext) {
const { styles } = getRequestDependencies(ssrContext, rendererContext);
let result = "";
for (const key in styles) {
const resource = styles[key];
result += `<link rel="stylesheet" href="${rendererContext.buildAssetsURL(resource.file)}" crossorigin>`;
}
return result;
}
function getResources(ssrContext, rendererContext) {
return [...getPreloadLinks(ssrContext, rendererContext), ...getPrefetchLinks(ssrContext, rendererContext)];
}
function renderResourceHints(ssrContext, rendererContext) {
const { preload, prefetch } = getRequestDependencies(ssrContext, rendererContext);
let result = "";
for (const key in preload) {
const resource = preload[key];
const href = rendererContext.buildAssetsURL(resource.file);
const rel = resource.module ? "modulepreload" : "preload";
const crossorigin = resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? " crossorigin" : "";
if (resource.resourceType && resource.mimeType) {
result += `<link rel="${rel}" as="${resource.resourceType}" type="${resource.mimeType}"${crossorigin} href="${href}">`;
} else if (resource.resourceType) {
result += `<link rel="${rel}" as="${resource.resourceType}"${crossorigin} href="${href}">`;
} else {
result += `<link rel="${rel}"${crossorigin} href="${href}">`;
}
}
for (const key in prefetch) {
const resource = prefetch[key];
const href = rendererContext.buildAssetsURL(resource.file);
const crossorigin = resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? " crossorigin" : "";
if (resource.resourceType && resource.mimeType) {
result += `<link rel="prefetch" as="${resource.resourceType}" type="${resource.mimeType}"${crossorigin} href="${href}">`;
} else if (resource.resourceType) {
result += `<link rel="prefetch" as="${resource.resourceType}"${crossorigin} href="${href}">`;
} else {
result += `<link rel="prefetch"${crossorigin} href="${href}">`;
}
}
return result;
}
function renderResourceHeaders(ssrContext, rendererContext) {
const { preload, prefetch } = getRequestDependencies(ssrContext, rendererContext);
const links = [];
for (const key in preload) {
const resource = preload[key];
const href = rendererContext.buildAssetsURL(resource.file);
const rel = resource.module ? "modulepreload" : "preload";
let header = `<${href}>; rel="${rel}"`;
if (resource.resourceType) {
header += `; as="${resource.resourceType}"`;
}
if (resource.mimeType) {
header += `; type="${resource.mimeType}"`;
}
if (resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module) {
header += "; crossorigin";
}
links.push(header);
}
for (const key in prefetch) {
const resource = prefetch[key];
const href = rendererContext.buildAssetsURL(resource.file);
let header = `<${href}>; rel="prefetch"`;
if (resource.resourceType) {
header += `; as="${resource.resourceType}"`;
}
if (resource.mimeType) {
header += `; type="${resource.mimeType}"`;
}
if (resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module) {
header += "; crossorigin";
}
links.push(header);
}
return {
link: links.join(", ")
};
}
function getPreloadLinks(ssrContext, rendererContext) {
const { preload } = getRequestDependencies(ssrContext, rendererContext);
const result = [];
for (const key in preload) {
const resource = preload[key];
result.push({
rel: resource.module ? "modulepreload" : "preload",
as: resource.resourceType,
type: resource.mimeType ?? null,
crossorigin: resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? "" : null,
href: rendererContext.buildAssetsURL(resource.file)
});
}
return result;
}
function getPrefetchLinks(ssrContext, rendererContext) {
const { prefetch } = getRequestDependencies(ssrContext, rendererContext);
const result = [];
for (const key in prefetch) {
const resource = prefetch[key];
result.push({
rel: "prefetch",
as: resource.resourceType,
type: resource.mimeType ?? null,
crossorigin: resource.resourceType === "style" || resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? "" : null,
href: rendererContext.buildAssetsURL(resource.file)
});
}
return result;
}
function renderScripts(ssrContext, rendererContext) {
const { scripts } = getRequestDependencies(ssrContext, rendererContext);
let result = "";
for (const key in scripts) {
const resource = scripts[key];
if (resource.module) {
result += `<script type="module" src="${rendererContext.buildAssetsURL(resource.file)}" crossorigin><\/script>`;
} else {
result += `<script src="${rendererContext.buildAssetsURL(resource.file)}" defer crossorigin><\/script>`;
}
}
return result;
}
function createRenderer(createApp, renderOptions) {
const rendererContext = createRendererContext(renderOptions);
return {
rendererContext,
async renderToString(ssrContext) {
ssrContext._registeredComponents = ssrContext._registeredComponents || /* @__PURE__ */ new Set();
const _createApp = await Promise.resolve(createApp).then((r) => "default" in r ? r.default : r);
const app = await _createApp(ssrContext);
const html = await renderOptions.renderToString(app, ssrContext);
const wrap = (fn) => () => fn(ssrContext, rendererContext);
return {
html,
renderResourceHeaders: wrap(renderResourceHeaders),
renderResourceHints: wrap(renderResourceHints),
renderStyles: wrap(renderStyles),
renderScripts: wrap(renderScripts)
};
}
};
}
export { createRenderer, createRendererContext, getAllDependencies, getModuleDependencies, getPrefetchLinks, getPreloadLinks, getRequestDependencies, getResources, renderResourceHeaders, renderResourceHints, renderScripts, renderStyles };

View File

@@ -0,0 +1,55 @@
{
"name": "vue-bundle-renderer",
"version": "2.2.0",
"description": "Bundle Renderer for Vue 3.0",
"repository": "nuxt-contrib/vue-bundle-renderer",
"license": "MIT",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./runtime": {
"types": "./dist/runtime.d.ts",
"import": "./dist/runtime.mjs",
"require": "./dist/runtime.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"runtime.d.ts"
],
"scripts": {
"build": "unbuild",
"dev": "vitest",
"lint": "eslint src",
"prepack": "unbuild",
"test": "pnpm lint && pnpm vitest run --coverage && tsc --noEmit",
"bench": "vitest bench"
},
"dependencies": {
"ufo": "^1.6.1"
},
"devDependencies": {
"@codspeed/vitest-plugin": "^5.0.0",
"@nuxt/eslint-config": "^1.9.0",
"@types/node": "^22.18.6",
"@types/semver": "^7.7.1",
"@vitest/coverage-v8": "^3.2.4",
"changelogen": "^0.6.2",
"eslint": "^9.36.0",
"pkg-pr-new": "^0.0.60",
"semver": "^7.7.2",
"std-env": "^3.9.0",
"typescript": "^5.9.2",
"unbuild": "^3.6.1",
"vite": "^7.1.7",
"vitest": "3.2.4",
"vue": "3.5.22"
},
"packageManager": "pnpm@10.17.1"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

153
.output/server/node_modules/vue-router/package.json generated vendored Normal file
View File

@@ -0,0 +1,153 @@
{
"name": "vue-router",
"version": "4.6.4",
"main": "index.js",
"unpkg": "dist/vue-router.global.js",
"jsdelivr": "dist/vue-router.global.js",
"module": "dist/vue-router.mjs",
"types": "dist/vue-router.d.mts",
"exports": {
".": {
"types": "./dist/vue-router.d.mts",
"node": {
"import": {
"production": "./vue-router.node.mjs",
"development": "./vue-router.node.mjs",
"default": "./vue-router.node.mjs"
},
"require": {
"production": "./dist/vue-router.prod.cjs",
"development": "./dist/vue-router.cjs",
"default": "./dist/vue-router.prod.cjs"
}
},
"import": "./dist/vue-router.mjs",
"require": "./index.js"
},
"./dist/*": "./dist/*",
"./vetur/*": "./vetur/*",
"./package.json": "./package.json",
"./experimental": "./dist/experimental/index.mjs",
"./auto-resolver": {
"types": "./vue-router-auto-resolver.d.mts"
},
"./auto-routes": {
"types": "./vue-router-auto-routes.d.ts",
"node": {
"import": {
"production": "./vue-router.node.mjs",
"development": "./vue-router.node.mjs",
"default": "./vue-router.node.mjs"
},
"require": {
"production": "./dist/vue-router.prod.cjs",
"development": "./dist/vue-router.cjs",
"default": "./dist/vue-router.prod.cjs"
}
},
"import": "./dist/vue-router.mjs",
"require": "./index.js"
},
"./auto": {
"types": "./vue-router-auto.d.ts",
"node": {
"import": {
"production": "./vue-router.node.mjs",
"development": "./vue-router.node.mjs",
"default": "./vue-router.node.mjs"
},
"require": {
"production": "./dist/vue-router.prod.cjs",
"development": "./dist/vue-router.cjs",
"default": "./dist/vue-router.prod.cjs"
}
},
"import": "./dist/vue-router.mjs",
"require": "./index.js"
}
},
"sideEffects": false,
"author": {
"name": "Eduardo San Martin Morote",
"email": "posva13@gmail.com"
},
"funding": "https://github.com/sponsors/posva",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/router.git"
},
"bugs": {
"url": "https://github.com/vuejs/router/issues"
},
"homepage": "https://router.vuejs.org",
"files": [
"vue-router-auto-resolver.d.mts",
"index.js",
"vue-router.node.mjs",
"vue-router-auto.d.ts",
"vue-router-auto-routes.d.ts",
"dist/**/*.{js,cjs,mjs}",
"dist/**/*.d.{ts,mts}",
"vetur/tags.json",
"vetur/attributes.json",
"README.md"
],
"peerDependencies": {
"vue": "^3.5.0"
},
"vetur": {
"tags": "vetur/tags.json",
"attributes": "vetur/attributes.json"
},
"dependencies": {
"@vue/devtools-api": "^6.6.4"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.7",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-replace": "^6.0.2",
"@rollup/plugin-terser": "^0.4.4",
"@types/jsdom": "^21.1.7",
"@types/nightwatch": "^2.3.32",
"@typescript/native-preview": "7.0.0-dev.20251013.1",
"@vitejs/plugin-vue": "^6.0.1",
"@vue/compiler-sfc": "~3.5.22",
"@vue/server-renderer": "~3.5.22",
"@vue/test-utils": "^2.4.6",
"browserstack-local": "^1.5.8",
"chromedriver": "^138.0.5",
"connect-history-api-fallback": "^1.6.0",
"dotenv": "^17.2.3",
"faked-promise": "^2.2.2",
"geckodriver": "^6.0.2",
"happy-dom": "^20.0.0",
"nightwatch": "^3.12.2",
"nightwatch-helpers": "^1.2.0",
"rimraf": "^6.0.1",
"rollup": "^4.52.4",
"rollup-plugin-typescript2": "^0.36.0",
"tsdown": "^0.17.2",
"tsup": "^8.5.0",
"vite": "^7.1.10",
"vue": "~3.6.0-alpha.2"
},
"scripts": {
"dev": "vitest --ui",
"build": "tsdown",
"build:old": "rimraf dist && rollup -c rollup.config.mjs",
"build:playground": "vue-tsc --noEmit && vite build --config playground/vite.config.ts",
"build:e2e": "vue-tsc --noEmit && vite build --config e2e/vite.config.mjs",
"build:size": "pnpm run build && rollup -c size-checks/rollup.config.mjs",
"dev:e2e": "vite --config e2e/vite.config.mjs",
"test:types": "tsc --build tsconfig.json",
"test:unit": "vitest --coverage run",
"test": "pnpm run build && pnpm run test:types && pnpm run test:unit && pnpm run test:e2e",
"test:e2e": "pnpm run test:e2e:headless",
"test:e2e:headless": "node e2e/runner.mjs --env chrome-headless",
"test:e2e:native": "node e2e/runner.mjs --env chrome",
"test:e2e:ci": "node e2e/runner.mjs --env chrome-headless --retries 2",
"test:e2e:bs": "node e2e/runner.mjs --local -e android5 --tag browserstack",
"test:e2e:bs-test": "node e2e/runner.mjs --local --env browserstack.local_chrome --tag browserstack"
}
}

View File

@@ -0,0 +1,2 @@
global.__VUE_PROD_DEVTOOLS__ = false
export * from './dist/vue-router.mjs'

80
.output/server/node_modules/vue/dist/vue.cjs.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
/**
* vue v3.5.28
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var compilerDom = require('@vue/compiler-dom');
var runtimeDom = require('@vue/runtime-dom');
var shared = require('@vue/shared');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
for (var k in e) {
n[k] = e[k];
}
}
n.default = e;
return Object.freeze(n);
}
var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
const compileCache = /* @__PURE__ */ Object.create(null);
function compileToFunction(template, options) {
if (!shared.isString(template)) {
if (template.nodeType) {
template = template.innerHTML;
} else {
runtimeDom.warn(`invalid template option: `, template);
return shared.NOOP;
}
}
const key = shared.genCacheKey(template, options);
const cached = compileCache[key];
if (cached) {
return cached;
}
if (template[0] === "#") {
const el = document.querySelector(template);
if (!el) {
runtimeDom.warn(`Template element not found or is empty: ${template}`);
}
template = el ? el.innerHTML : ``;
}
const opts = shared.extend(
{
hoistStatic: true,
onError: onError ,
onWarn: (e) => onError(e, true)
},
options
);
if (!opts.isCustomElement && typeof customElements !== "undefined") {
opts.isCustomElement = (tag) => !!customElements.get(tag);
}
const { code } = compilerDom.compile(template, opts);
function onError(err, asWarning = false) {
const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
const codeFrame = err.loc && shared.generateCodeFrame(
template,
err.loc.start.offset,
err.loc.end.offset
);
runtimeDom.warn(codeFrame ? `${message}
${codeFrame}` : message);
}
const render = new Function("Vue", code)(runtimeDom__namespace);
render._rc = true;
return compileCache[key] = render;
}
runtimeDom.registerRuntimeCompiler(compileToFunction);
exports.compile = compileToFunction;
Object.keys(runtimeDom).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
});

66
.output/server/node_modules/vue/dist/vue.cjs.prod.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
/**
* vue v3.5.28
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var compilerDom = require('@vue/compiler-dom');
var runtimeDom = require('@vue/runtime-dom');
var shared = require('@vue/shared');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
for (var k in e) {
n[k] = e[k];
}
}
n.default = e;
return Object.freeze(n);
}
var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
const compileCache = /* @__PURE__ */ Object.create(null);
function compileToFunction(template, options) {
if (!shared.isString(template)) {
if (template.nodeType) {
template = template.innerHTML;
} else {
return shared.NOOP;
}
}
const key = shared.genCacheKey(template, options);
const cached = compileCache[key];
if (cached) {
return cached;
}
if (template[0] === "#") {
const el = document.querySelector(template);
template = el ? el.innerHTML : ``;
}
const opts = shared.extend(
{
hoistStatic: true,
onError: void 0,
onWarn: shared.NOOP
},
options
);
if (!opts.isCustomElement && typeof customElements !== "undefined") {
opts.isCustomElement = (tag) => !!customElements.get(tag);
}
const { code } = compilerDom.compile(template, opts);
const render = new Function("Vue", code)(runtimeDom__namespace);
render._rc = true;
return compileCache[key] = render;
}
runtimeDom.registerRuntimeCompiler(compileToFunction);
exports.compile = compileToFunction;
Object.keys(runtimeDom).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
});

7
.output/server/node_modules/vue/index.js generated vendored Normal file
View File

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

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

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

112
.output/server/node_modules/vue/package.json generated vendored Normal file
View File

@@ -0,0 +1,112 @@
{
"name": "vue",
"version": "3.5.28",
"description": "The progressive JavaScript framework for building modern web UI.",
"main": "index.js",
"module": "dist/vue.runtime.esm-bundler.js",
"types": "dist/vue.d.ts",
"unpkg": "dist/vue.global.js",
"jsdelivr": "dist/vue.global.js",
"files": [
"index.js",
"index.mjs",
"dist",
"compiler-sfc",
"server-renderer",
"jsx-runtime",
"jsx.d.ts"
],
"exports": {
".": {
"import": {
"types": "./dist/vue.d.mts",
"node": "./index.mjs",
"default": "./dist/vue.runtime.esm-bundler.js"
},
"require": {
"types": "./dist/vue.d.ts",
"node": {
"production": "./dist/vue.cjs.prod.js",
"development": "./dist/vue.cjs.js",
"default": "./dist/vue.cjs.prod.js"
},
"default": "./index.js"
}
},
"./server-renderer": {
"import": {
"types": "./server-renderer/index.d.mts",
"default": "./server-renderer/index.mjs"
},
"require": {
"types": "./server-renderer/index.d.ts",
"default": "./server-renderer/index.js"
}
},
"./compiler-sfc": {
"import": {
"types": "./compiler-sfc/index.d.mts",
"browser": "./compiler-sfc/index.browser.mjs",
"default": "./compiler-sfc/index.mjs"
},
"require": {
"types": "./compiler-sfc/index.d.ts",
"browser": "./compiler-sfc/index.browser.js",
"default": "./compiler-sfc/index.js"
}
},
"./jsx-runtime": {
"types": "./jsx-runtime/index.d.ts",
"import": "./jsx-runtime/index.mjs",
"require": "./jsx-runtime/index.js"
},
"./jsx-dev-runtime": {
"types": "./jsx-runtime/index.d.ts",
"import": "./jsx-runtime/index.mjs",
"require": "./jsx-runtime/index.js"
},
"./jsx": "./jsx.d.ts",
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},
"buildOptions": {
"name": "Vue",
"formats": [
"esm-bundler",
"esm-bundler-runtime",
"cjs",
"global",
"global-runtime",
"esm-browser",
"esm-browser-runtime"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue#readme",
"dependencies": {
"@vue/shared": "3.5.28",
"@vue/compiler-dom": "3.5.28",
"@vue/compiler-sfc": "3.5.28",
"@vue/runtime-dom": "3.5.28",
"@vue/server-renderer": "3.5.28"
},
"peerDependencies": {
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
}

View File

@@ -0,0 +1 @@
export * from '@vue/server-renderer'