no message
This commit is contained in:
@@ -1,15 +1,731 @@
|
||||
import { version, unref, inject, hasInjectionContext, getCurrentInstance, ref, computed, createApp, effectScope, reactive, useSSRContext, defineAsyncComponent, provide, onErrorCaptured, onServerPrefetch, createVNode, resolveDynamicComponent, toRef, shallowRef, shallowReactive, isReadonly, isRef, isShallow, isReactive, toRaw, resolveComponent, mergeProps, nextTick } from 'vue';
|
||||
import { d as useRuntimeConfig$1, $ as $fetch, w as withQuery, l as hasProtocol, p as parseURL, m as isScriptProtocol, j as joinURL, h as createError$1, n as sanitizeStatusCode, o as createHooks } from '../nitro/node-server.mjs';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import { l as destr, d as useRuntimeConfig$1 } from '../nitro/node-server.mjs';
|
||||
import { getActiveHead } from 'unhead';
|
||||
import { defineHeadPlugin } from '@unhead/shared';
|
||||
import { createMemoryHistory, createRouter, START_LOCATION } from 'vue-router';
|
||||
import { ssrRenderSuspense, ssrRenderComponent, ssrRenderVNode } from 'vue/server-renderer';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'fs';
|
||||
import 'path';
|
||||
import 'node:fs';
|
||||
import 'node:url';
|
||||
|
||||
const s=globalThis.Headers,i=globalThis.AbortController,l=globalThis.fetch||(()=>{throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!")});
|
||||
|
||||
const HASH_RE = /#/g;
|
||||
const AMPERSAND_RE = /&/g;
|
||||
const EQUAL_RE = /=/g;
|
||||
const PLUS_RE = /\+/g;
|
||||
const ENC_CARET_RE = /%5e/gi;
|
||||
const ENC_BACKTICK_RE = /%60/gi;
|
||||
const ENC_PIPE_RE = /%7c/gi;
|
||||
const ENC_SPACE_RE = /%20/gi;
|
||||
function encode(text) {
|
||||
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
||||
}
|
||||
function encodeQueryValue(input) {
|
||||
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
|
||||
}
|
||||
function encodeQueryKey(text) {
|
||||
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
||||
}
|
||||
function decode(text = "") {
|
||||
try {
|
||||
return decodeURIComponent("" + text);
|
||||
} catch {
|
||||
return "" + text;
|
||||
}
|
||||
}
|
||||
function decodeQueryKey(text) {
|
||||
return decode(text.replace(PLUS_RE, " "));
|
||||
}
|
||||
function decodeQueryValue(text) {
|
||||
return decode(text.replace(PLUS_RE, " "));
|
||||
}
|
||||
|
||||
function parseQuery(parametersString = "") {
|
||||
const object = {};
|
||||
if (parametersString[0] === "?") {
|
||||
parametersString = parametersString.slice(1);
|
||||
}
|
||||
for (const parameter of parametersString.split("&")) {
|
||||
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
||||
if (s.length < 2) {
|
||||
continue;
|
||||
}
|
||||
const key = decodeQueryKey(s[1]);
|
||||
if (key === "__proto__" || key === "constructor") {
|
||||
continue;
|
||||
}
|
||||
const value = decodeQueryValue(s[2] || "");
|
||||
if (object[key] === void 0) {
|
||||
object[key] = value;
|
||||
} else if (Array.isArray(object[key])) {
|
||||
object[key].push(value);
|
||||
} else {
|
||||
object[key] = [object[key], value];
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
function encodeQueryItem(key, value) {
|
||||
if (typeof value === "number" || typeof value === "boolean") {
|
||||
value = String(value);
|
||||
}
|
||||
if (!value) {
|
||||
return encodeQueryKey(key);
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
||||
}
|
||||
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
||||
}
|
||||
function stringifyQuery(query) {
|
||||
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
||||
}
|
||||
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
||||
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
||||
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
||||
function hasProtocol(inputString, opts = {}) {
|
||||
if (typeof opts === "boolean") {
|
||||
opts = { acceptRelative: opts };
|
||||
}
|
||||
if (opts.strict) {
|
||||
return PROTOCOL_STRICT_REGEX.test(inputString);
|
||||
}
|
||||
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
||||
}
|
||||
const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i;
|
||||
function isScriptProtocol(protocol) {
|
||||
return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol);
|
||||
}
|
||||
const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
||||
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
||||
if (!respectQueryAndFragment) {
|
||||
return input.endsWith("/");
|
||||
}
|
||||
return TRAILING_SLASH_RE.test(input);
|
||||
}
|
||||
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
||||
if (!respectQueryAndFragment) {
|
||||
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
||||
}
|
||||
if (!hasTrailingSlash(input, true)) {
|
||||
return input || "/";
|
||||
}
|
||||
let path = input;
|
||||
let fragment = "";
|
||||
const fragmentIndex = input.indexOf("#");
|
||||
if (fragmentIndex >= 0) {
|
||||
path = input.slice(0, fragmentIndex);
|
||||
fragment = input.slice(fragmentIndex);
|
||||
}
|
||||
const [s0, ...s] = path.split("?");
|
||||
return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
||||
}
|
||||
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
||||
if (!respectQueryAndFragment) {
|
||||
return input.endsWith("/") ? input : input + "/";
|
||||
}
|
||||
if (hasTrailingSlash(input, true)) {
|
||||
return input || "/";
|
||||
}
|
||||
let path = input;
|
||||
let fragment = "";
|
||||
const fragmentIndex = input.indexOf("#");
|
||||
if (fragmentIndex >= 0) {
|
||||
path = input.slice(0, fragmentIndex);
|
||||
fragment = input.slice(fragmentIndex);
|
||||
if (!path) {
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
const [s0, ...s] = path.split("?");
|
||||
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
||||
}
|
||||
function withBase(input, base) {
|
||||
if (isEmptyURL(base) || hasProtocol(input)) {
|
||||
return input;
|
||||
}
|
||||
const _base = withoutTrailingSlash(base);
|
||||
if (input.startsWith(_base)) {
|
||||
return input;
|
||||
}
|
||||
return joinURL(_base, input);
|
||||
}
|
||||
function withQuery(input, query) {
|
||||
const parsed = parseURL(input);
|
||||
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
||||
parsed.search = stringifyQuery(mergedQuery);
|
||||
return stringifyParsedURL(parsed);
|
||||
}
|
||||
function isEmptyURL(url) {
|
||||
return !url || url === "/";
|
||||
}
|
||||
function isNonEmptyURL(url) {
|
||||
return url && url !== "/";
|
||||
}
|
||||
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
||||
function joinURL(base, ...input) {
|
||||
let url = base || "";
|
||||
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
|
||||
if (url) {
|
||||
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
|
||||
url = withTrailingSlash(url) + _segment;
|
||||
} else {
|
||||
url = segment;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
function parseURL(input = "", defaultProto) {
|
||||
const _specialProtoMatch = input.match(
|
||||
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
|
||||
);
|
||||
if (_specialProtoMatch) {
|
||||
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
||||
return {
|
||||
protocol: _proto.toLowerCase(),
|
||||
pathname: _pathname,
|
||||
href: _proto + _pathname,
|
||||
auth: "",
|
||||
host: "",
|
||||
search: "",
|
||||
hash: ""
|
||||
};
|
||||
}
|
||||
if (!hasProtocol(input, { acceptRelative: true })) {
|
||||
return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
|
||||
}
|
||||
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
||||
const [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
||||
const { pathname, search, hash } = parsePath(
|
||||
path.replace(/\/(?=[A-Za-z]:)/, "")
|
||||
);
|
||||
return {
|
||||
protocol: protocol.toLowerCase(),
|
||||
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
||||
host,
|
||||
pathname,
|
||||
search,
|
||||
hash
|
||||
};
|
||||
}
|
||||
function parsePath(input = "") {
|
||||
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
||||
return {
|
||||
pathname,
|
||||
search,
|
||||
hash
|
||||
};
|
||||
}
|
||||
function stringifyParsedURL(parsed) {
|
||||
const pathname = parsed.pathname || "";
|
||||
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
||||
const hash = parsed.hash || "";
|
||||
const auth = parsed.auth ? parsed.auth + "@" : "";
|
||||
const host = parsed.host || "";
|
||||
const proto = parsed.protocol ? parsed.protocol + "//" : "";
|
||||
return proto + auth + host + pathname + search + hash;
|
||||
}
|
||||
|
||||
class FetchError extends Error {
|
||||
constructor(message, opts) {
|
||||
super(message, opts);
|
||||
this.name = "FetchError";
|
||||
if (opts?.cause && !this.cause) {
|
||||
this.cause = opts.cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
function createFetchError(ctx) {
|
||||
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
||||
const method = ctx.request?.method || ctx.options?.method || "GET";
|
||||
const url = ctx.request?.url || String(ctx.request) || "/";
|
||||
const requestStr = `[${method}] ${JSON.stringify(url)}`;
|
||||
const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>";
|
||||
const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`;
|
||||
const fetchError = new FetchError(
|
||||
message,
|
||||
ctx.error ? { cause: ctx.error } : void 0
|
||||
);
|
||||
for (const key of ["request", "options", "response"]) {
|
||||
Object.defineProperty(fetchError, key, {
|
||||
get() {
|
||||
return ctx[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
for (const [key, refKey] of [
|
||||
["data", "_data"],
|
||||
["status", "status"],
|
||||
["statusCode", "status"],
|
||||
["statusText", "statusText"],
|
||||
["statusMessage", "statusText"]
|
||||
]) {
|
||||
Object.defineProperty(fetchError, key, {
|
||||
get() {
|
||||
return ctx.response && ctx.response[refKey];
|
||||
}
|
||||
});
|
||||
}
|
||||
return fetchError;
|
||||
}
|
||||
|
||||
const payloadMethods = new Set(
|
||||
Object.freeze(["PATCH", "POST", "PUT", "DELETE"])
|
||||
);
|
||||
function isPayloadMethod(method = "GET") {
|
||||
return payloadMethods.has(method.toUpperCase());
|
||||
}
|
||||
function isJSONSerializable(value) {
|
||||
if (value === void 0) {
|
||||
return false;
|
||||
}
|
||||
const t = typeof value;
|
||||
if (t === "string" || t === "number" || t === "boolean" || t === null) {
|
||||
return true;
|
||||
}
|
||||
if (t !== "object") {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return true;
|
||||
}
|
||||
if (value.buffer) {
|
||||
return false;
|
||||
}
|
||||
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
||||
}
|
||||
const textTypes = /* @__PURE__ */ new Set([
|
||||
"image/svg",
|
||||
"application/xml",
|
||||
"application/xhtml",
|
||||
"application/html"
|
||||
]);
|
||||
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
||||
function detectResponseType(_contentType = "") {
|
||||
if (!_contentType) {
|
||||
return "json";
|
||||
}
|
||||
const contentType = _contentType.split(";").shift() || "";
|
||||
if (JSON_RE.test(contentType)) {
|
||||
return "json";
|
||||
}
|
||||
if (textTypes.has(contentType) || contentType.startsWith("text/")) {
|
||||
return "text";
|
||||
}
|
||||
return "blob";
|
||||
}
|
||||
function mergeFetchOptions(input, defaults, Headers = globalThis.Headers) {
|
||||
const merged = {
|
||||
...defaults,
|
||||
...input
|
||||
};
|
||||
if (defaults?.params && input?.params) {
|
||||
merged.params = {
|
||||
...defaults?.params,
|
||||
...input?.params
|
||||
};
|
||||
}
|
||||
if (defaults?.query && input?.query) {
|
||||
merged.query = {
|
||||
...defaults?.query,
|
||||
...input?.query
|
||||
};
|
||||
}
|
||||
if (defaults?.headers && input?.headers) {
|
||||
merged.headers = new Headers(defaults?.headers || {});
|
||||
for (const [key, value] of new Headers(input?.headers || {})) {
|
||||
merged.headers.set(key, value);
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
const retryStatusCodes = /* @__PURE__ */ new Set([
|
||||
408,
|
||||
// Request Timeout
|
||||
409,
|
||||
// Conflict
|
||||
425,
|
||||
// Too Early
|
||||
429,
|
||||
// Too Many Requests
|
||||
500,
|
||||
// Internal Server Error
|
||||
502,
|
||||
// Bad Gateway
|
||||
503,
|
||||
// Service Unavailable
|
||||
504
|
||||
// Gateway Timeout
|
||||
]);
|
||||
const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
||||
function createFetch(globalOptions = {}) {
|
||||
const {
|
||||
fetch = globalThis.fetch,
|
||||
Headers = globalThis.Headers,
|
||||
AbortController = globalThis.AbortController
|
||||
} = globalOptions;
|
||||
async function onError(context) {
|
||||
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
||||
if (context.options.retry !== false && !isAbort) {
|
||||
let retries;
|
||||
if (typeof context.options.retry === "number") {
|
||||
retries = context.options.retry;
|
||||
} else {
|
||||
retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
||||
}
|
||||
const responseCode = context.response && context.response.status || 500;
|
||||
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
||||
const retryDelay = context.options.retryDelay || 0;
|
||||
if (retryDelay > 0) {
|
||||
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
||||
}
|
||||
return $fetchRaw(context.request, {
|
||||
...context.options,
|
||||
retry: retries - 1,
|
||||
timeout: context.options.timeout
|
||||
});
|
||||
}
|
||||
}
|
||||
const error = createFetchError(context);
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(error, $fetchRaw);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
|
||||
const context = {
|
||||
request: _request,
|
||||
options: mergeFetchOptions(_options, globalOptions.defaults, Headers),
|
||||
response: void 0,
|
||||
error: void 0
|
||||
};
|
||||
context.options.method = context.options.method?.toUpperCase();
|
||||
if (context.options.onRequest) {
|
||||
await context.options.onRequest(context);
|
||||
}
|
||||
if (typeof context.request === "string") {
|
||||
if (context.options.baseURL) {
|
||||
context.request = withBase(context.request, context.options.baseURL);
|
||||
}
|
||||
if (context.options.query || context.options.params) {
|
||||
context.request = withQuery(context.request, {
|
||||
...context.options.params,
|
||||
...context.options.query
|
||||
});
|
||||
}
|
||||
}
|
||||
if (context.options.body && isPayloadMethod(context.options.method)) {
|
||||
if (isJSONSerializable(context.options.body)) {
|
||||
context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
|
||||
context.options.headers = new Headers(context.options.headers || {});
|
||||
if (!context.options.headers.has("content-type")) {
|
||||
context.options.headers.set("content-type", "application/json");
|
||||
}
|
||||
if (!context.options.headers.has("accept")) {
|
||||
context.options.headers.set("accept", "application/json");
|
||||
}
|
||||
} else if (
|
||||
// ReadableStream Body
|
||||
"pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || // Node.js Stream Body
|
||||
typeof context.options.body.pipe === "function"
|
||||
) {
|
||||
if (!("duplex" in context.options)) {
|
||||
context.options.duplex = "half";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!context.options.signal && context.options.timeout) {
|
||||
const controller = new AbortController();
|
||||
setTimeout(() => controller.abort(), context.options.timeout);
|
||||
context.options.signal = controller.signal;
|
||||
}
|
||||
try {
|
||||
context.response = await fetch(
|
||||
context.request,
|
||||
context.options
|
||||
);
|
||||
} catch (error) {
|
||||
context.error = error;
|
||||
if (context.options.onRequestError) {
|
||||
await context.options.onRequestError(context);
|
||||
}
|
||||
return await onError(context);
|
||||
}
|
||||
const hasBody = context.response.body && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD";
|
||||
if (hasBody) {
|
||||
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
||||
switch (responseType) {
|
||||
case "json": {
|
||||
const data = await context.response.text();
|
||||
const parseFunction = context.options.parseResponse || destr;
|
||||
context.response._data = parseFunction(data);
|
||||
break;
|
||||
}
|
||||
case "stream": {
|
||||
context.response._data = context.response.body;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
context.response._data = await context.response[responseType]();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context.options.onResponse) {
|
||||
await context.options.onResponse(context);
|
||||
}
|
||||
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
||||
if (context.options.onResponseError) {
|
||||
await context.options.onResponseError(context);
|
||||
}
|
||||
return await onError(context);
|
||||
}
|
||||
return context.response;
|
||||
};
|
||||
const $fetch = async function $fetch2(request, options) {
|
||||
const r = await $fetchRaw(request, options);
|
||||
return r._data;
|
||||
};
|
||||
$fetch.raw = $fetchRaw;
|
||||
$fetch.native = (...args) => fetch(...args);
|
||||
$fetch.create = (defaultOptions = {}) => createFetch({
|
||||
...globalOptions,
|
||||
defaults: {
|
||||
...globalOptions.defaults,
|
||||
...defaultOptions
|
||||
}
|
||||
});
|
||||
return $fetch;
|
||||
}
|
||||
|
||||
function createNodeFetch() {
|
||||
const useKeepAlive = JSON.parse(process.env.FETCH_KEEP_ALIVE || "false");
|
||||
if (!useKeepAlive) {
|
||||
return l;
|
||||
}
|
||||
const agentOptions = { keepAlive: true };
|
||||
const httpAgent = new http.Agent(agentOptions);
|
||||
const httpsAgent = new https.Agent(agentOptions);
|
||||
const nodeFetchOptions = {
|
||||
agent(parsedURL) {
|
||||
return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
|
||||
}
|
||||
};
|
||||
return function nodeFetchWithKeepAlive(input, init) {
|
||||
return l(input, { ...nodeFetchOptions, ...init });
|
||||
};
|
||||
}
|
||||
const fetch = globalThis.fetch || createNodeFetch();
|
||||
const Headers$1 = globalThis.Headers || s;
|
||||
const AbortController = globalThis.AbortController || i;
|
||||
const ofetch = createFetch({ fetch, Headers: Headers$1, AbortController });
|
||||
const $fetch = ofetch;
|
||||
|
||||
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;
|
||||
}
|
||||
const defaultTask = { run: (function_) => function_() };
|
||||
const _createTask = () => defaultTask;
|
||||
const createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask;
|
||||
function serialTaskCaller(hooks, args) {
|
||||
const name = args.shift();
|
||||
const task = createTask(name);
|
||||
return hooks.reduce(
|
||||
(promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))),
|
||||
Promise.resolve()
|
||||
);
|
||||
}
|
||||
function parallelTaskCaller(hooks, args) {
|
||||
const name = args.shift();
|
||||
const task = createTask(name);
|
||||
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
||||
}
|
||||
function callEachWith(callbacks, arg0) {
|
||||
for (const callback of [...callbacks]) {
|
||||
callback(arg0);
|
||||
}
|
||||
}
|
||||
|
||||
class Hookable {
|
||||
constructor() {
|
||||
this._hooks = {};
|
||||
this._before = void 0;
|
||||
this._after = void 0;
|
||||
this._deprecatedMessages = void 0;
|
||||
this._deprecatedHooks = {};
|
||||
this.hook = this.hook.bind(this);
|
||||
this.callHook = this.callHook.bind(this);
|
||||
this.callHookWith = this.callHookWith.bind(this);
|
||||
}
|
||||
hook(name, function_, options = {}) {
|
||||
if (!name || typeof function_ !== "function") {
|
||||
return () => {
|
||||
};
|
||||
}
|
||||
const originalName = name;
|
||||
let dep;
|
||||
while (this._deprecatedHooks[name]) {
|
||||
dep = this._deprecatedHooks[name];
|
||||
name = dep.to;
|
||||
}
|
||||
if (dep && !options.allowDeprecated) {
|
||||
let message = dep.message;
|
||||
if (!message) {
|
||||
message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
||||
}
|
||||
if (!this._deprecatedMessages) {
|
||||
this._deprecatedMessages = /* @__PURE__ */ new Set();
|
||||
}
|
||||
if (!this._deprecatedMessages.has(message)) {
|
||||
console.warn(message);
|
||||
this._deprecatedMessages.add(message);
|
||||
}
|
||||
}
|
||||
if (!function_.name) {
|
||||
try {
|
||||
Object.defineProperty(function_, "name", {
|
||||
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
||||
configurable: true
|
||||
});
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
this._hooks[name] = this._hooks[name] || [];
|
||||
this._hooks[name].push(function_);
|
||||
return () => {
|
||||
if (function_) {
|
||||
this.removeHook(name, function_);
|
||||
function_ = void 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
hookOnce(name, function_) {
|
||||
let _unreg;
|
||||
let _function = (...arguments_) => {
|
||||
if (typeof _unreg === "function") {
|
||||
_unreg();
|
||||
}
|
||||
_unreg = void 0;
|
||||
_function = void 0;
|
||||
return function_(...arguments_);
|
||||
};
|
||||
_unreg = this.hook(name, _function);
|
||||
return _unreg;
|
||||
}
|
||||
removeHook(name, function_) {
|
||||
if (this._hooks[name]) {
|
||||
const index = this._hooks[name].indexOf(function_);
|
||||
if (index !== -1) {
|
||||
this._hooks[name].splice(index, 1);
|
||||
}
|
||||
if (this._hooks[name].length === 0) {
|
||||
delete this._hooks[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
deprecateHook(name, deprecated) {
|
||||
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
||||
const _hooks = this._hooks[name] || [];
|
||||
delete this._hooks[name];
|
||||
for (const hook of _hooks) {
|
||||
this.hook(name, hook);
|
||||
}
|
||||
}
|
||||
deprecateHooks(deprecatedHooks) {
|
||||
Object.assign(this._deprecatedHooks, deprecatedHooks);
|
||||
for (const name in deprecatedHooks) {
|
||||
this.deprecateHook(name, deprecatedHooks[name]);
|
||||
}
|
||||
}
|
||||
addHooks(configHooks) {
|
||||
const hooks = flatHooks(configHooks);
|
||||
const removeFns = Object.keys(hooks).map(
|
||||
(key) => this.hook(key, hooks[key])
|
||||
);
|
||||
return () => {
|
||||
for (const unreg of removeFns.splice(0, removeFns.length)) {
|
||||
unreg();
|
||||
}
|
||||
};
|
||||
}
|
||||
removeHooks(configHooks) {
|
||||
const hooks = flatHooks(configHooks);
|
||||
for (const key in hooks) {
|
||||
this.removeHook(key, hooks[key]);
|
||||
}
|
||||
}
|
||||
removeAllHooks() {
|
||||
for (const key in this._hooks) {
|
||||
delete this._hooks[key];
|
||||
}
|
||||
}
|
||||
callHook(name, ...arguments_) {
|
||||
arguments_.unshift(name);
|
||||
return this.callHookWith(serialTaskCaller, name, ...arguments_);
|
||||
}
|
||||
callHookParallel(name, ...arguments_) {
|
||||
arguments_.unshift(name);
|
||||
return this.callHookWith(parallelTaskCaller, name, ...arguments_);
|
||||
}
|
||||
callHookWith(caller, name, ...arguments_) {
|
||||
const event = this._before || this._after ? { name, args: arguments_, context: {} } : void 0;
|
||||
if (this._before) {
|
||||
callEachWith(this._before, event);
|
||||
}
|
||||
const result = caller(
|
||||
name in this._hooks ? [...this._hooks[name]] : [],
|
||||
arguments_
|
||||
);
|
||||
if (result instanceof Promise) {
|
||||
return result.finally(() => {
|
||||
if (this._after && event) {
|
||||
callEachWith(this._after, event);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this._after && event) {
|
||||
callEachWith(this._after, event);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
beforeEach(function_) {
|
||||
this._before = this._before || [];
|
||||
this._before.push(function_);
|
||||
return () => {
|
||||
if (this._before !== void 0) {
|
||||
const index = this._before.indexOf(function_);
|
||||
if (index !== -1) {
|
||||
this._before.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
afterEach(function_) {
|
||||
this._after = this._after || [];
|
||||
this._after.push(function_);
|
||||
return () => {
|
||||
if (this._after !== void 0) {
|
||||
const index = this._after.indexOf(function_);
|
||||
if (index !== -1) {
|
||||
this._after.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
function createHooks() {
|
||||
return new Hookable();
|
||||
}
|
||||
|
||||
function createContext$1(opts = {}) {
|
||||
let currentInstance;
|
||||
@@ -108,6 +824,125 @@ const getContext = (key, opts = {}) => defaultNamespace$1.get(key, opts);
|
||||
const asyncHandlersKey$1 = "__unctx_async_handlers__";
|
||||
const asyncHandlers$1 = _globalThis$1[asyncHandlersKey$1] || (_globalThis$1[asyncHandlersKey$1] = /* @__PURE__ */ new Set());
|
||||
|
||||
function hasProp(obj, prop) {
|
||||
try {
|
||||
return prop in obj;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var __defProp$1 = Object.defineProperty;
|
||||
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __publicField$1 = (obj, key, value) => {
|
||||
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
||||
return value;
|
||||
};
|
||||
class H3Error extends Error {
|
||||
constructor(message, opts = {}) {
|
||||
super(message, opts);
|
||||
__publicField$1(this, "statusCode", 500);
|
||||
__publicField$1(this, "fatal", false);
|
||||
__publicField$1(this, "unhandled", false);
|
||||
__publicField$1(this, "statusMessage");
|
||||
__publicField$1(this, "data");
|
||||
__publicField$1(this, "cause");
|
||||
if (opts.cause && !this.cause) {
|
||||
this.cause = opts.cause;
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
const obj = {
|
||||
message: this.message,
|
||||
statusCode: sanitizeStatusCode(this.statusCode, 500)
|
||||
};
|
||||
if (this.statusMessage) {
|
||||
obj.statusMessage = sanitizeStatusMessage(this.statusMessage);
|
||||
}
|
||||
if (this.data !== void 0) {
|
||||
obj.data = this.data;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
__publicField$1(H3Error, "__h3_error__", true);
|
||||
function createError$1(input) {
|
||||
if (typeof input === "string") {
|
||||
return new H3Error(input);
|
||||
}
|
||||
if (isError(input)) {
|
||||
return input;
|
||||
}
|
||||
const err = new H3Error(input.message ?? input.statusMessage ?? "", {
|
||||
cause: input.cause || input
|
||||
});
|
||||
if (hasProp(input, "stack")) {
|
||||
try {
|
||||
Object.defineProperty(err, "stack", {
|
||||
get() {
|
||||
return input.stack;
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
try {
|
||||
err.stack = input.stack;
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (input.data) {
|
||||
err.data = input.data;
|
||||
}
|
||||
if (input.statusCode) {
|
||||
err.statusCode = sanitizeStatusCode(input.statusCode, err.statusCode);
|
||||
} else if (input.status) {
|
||||
err.statusCode = sanitizeStatusCode(input.status, err.statusCode);
|
||||
}
|
||||
if (input.statusMessage) {
|
||||
err.statusMessage = input.statusMessage;
|
||||
} else if (input.statusText) {
|
||||
err.statusMessage = input.statusText;
|
||||
}
|
||||
if (err.statusMessage) {
|
||||
const originalMessage = err.statusMessage;
|
||||
const sanitizedMessage = sanitizeStatusMessage(err.statusMessage);
|
||||
if (sanitizedMessage !== originalMessage) {
|
||||
console.warn(
|
||||
"[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default."
|
||||
);
|
||||
}
|
||||
}
|
||||
if (input.fatal !== void 0) {
|
||||
err.fatal = input.fatal;
|
||||
}
|
||||
if (input.unhandled !== void 0) {
|
||||
err.unhandled = input.unhandled;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
function isError(input) {
|
||||
return input?.constructor?.__h3_error__ === true;
|
||||
}
|
||||
|
||||
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
||||
function sanitizeStatusMessage(statusMessage = "") {
|
||||
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
||||
}
|
||||
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
||||
if (!statusCode) {
|
||||
return defaultStatusCode;
|
||||
}
|
||||
if (typeof statusCode === "string") {
|
||||
statusCode = Number.parseInt(statusCode, 10);
|
||||
}
|
||||
if (statusCode < 100 || statusCode > 999) {
|
||||
return defaultStatusCode;
|
||||
}
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
typeof setImmediate === "undefined" ? (fn) => fn() : setImmediate;
|
||||
|
||||
const appConfig = useRuntimeConfig$1().app;
|
||||
const baseURL = () => appConfig.baseURL;
|
||||
if (!globalThis.$fetch) {
|
||||
@@ -127,7 +962,7 @@ function createNuxtApp(options) {
|
||||
globalName: "nuxt",
|
||||
versions: {
|
||||
get nuxt() {
|
||||
return "3.9.0";
|
||||
return "3.9.3";
|
||||
},
|
||||
get vue() {
|
||||
return nuxtApp.vueApp.version;
|
||||
@@ -352,7 +1187,7 @@ function injectHead() {
|
||||
console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
|
||||
return head || getActiveHead();
|
||||
}
|
||||
const unhead_KgADcZ0jPj = /* @__PURE__ */ defineNuxtPlugin({
|
||||
const unhead_JC77S3HdgF = /* @__PURE__ */ defineNuxtPlugin({
|
||||
name: "nuxt:head",
|
||||
enforce: "pre",
|
||||
setup(nuxtApp) {
|
||||
@@ -604,7 +1439,7 @@ const _routes = [
|
||||
meta: {},
|
||||
alias: [],
|
||||
redirect: void 0,
|
||||
component: () => import('./_nuxt/_id_-uEgokcr5.mjs').then((m) => m.default || m)
|
||||
component: () => import('./_nuxt/_id_-hh8J-f8n.mjs').then((m) => m.default || m)
|
||||
},
|
||||
{
|
||||
name: "index.html",
|
||||
@@ -612,7 +1447,7 @@ const _routes = [
|
||||
meta: {},
|
||||
alias: [],
|
||||
redirect: void 0,
|
||||
component: () => import('./_nuxt/index-UHO4cBMd.mjs').then((m) => m.default || m)
|
||||
component: () => import('./_nuxt/index-ybIXcAmW.mjs').then((m) => m.default || m)
|
||||
},
|
||||
{
|
||||
name: "index",
|
||||
@@ -620,7 +1455,7 @@ const _routes = [
|
||||
meta: {},
|
||||
alias: [],
|
||||
redirect: void 0,
|
||||
component: () => import('./_nuxt/index-Ks92EJU9.mjs').then((m) => m.default || m)
|
||||
component: () => import('./_nuxt/index-OxdLOzQ1.mjs').then((m) => m.default || m)
|
||||
},
|
||||
{
|
||||
name: "publish",
|
||||
@@ -628,7 +1463,7 @@ const _routes = [
|
||||
meta: {},
|
||||
alias: [],
|
||||
redirect: void 0,
|
||||
component: () => import('./_nuxt/index-CT_QaZcm.mjs').then((m) => m.default || m)
|
||||
component: () => import('./_nuxt/index-evoz2oDg.mjs').then((m) => m.default || m)
|
||||
}
|
||||
];
|
||||
function generateRouteKey(route) {
|
||||
@@ -639,7 +1474,7 @@ function generateRouteKey(route) {
|
||||
return typeof source === "function" ? source(route) : source;
|
||||
}
|
||||
function isChangingPage(to, from) {
|
||||
if (to === from) {
|
||||
if (to === from || from === START_LOCATION) {
|
||||
return false;
|
||||
}
|
||||
if (generateRouteKey(to) !== generateRouteKey(from)) {
|
||||
@@ -906,7 +1741,7 @@ const reducers = {
|
||||
Ref: (data) => isRef(data) && data.value,
|
||||
Reactive: (data) => isReactive(data) && toRaw(data)
|
||||
};
|
||||
const revive_payload_server_eJ33V7gbc6 = /* @__PURE__ */ defineNuxtPlugin({
|
||||
const revive_payload_server_ncE5z6iePW = /* @__PURE__ */ defineNuxtPlugin({
|
||||
name: "nuxt:revive-payload:server",
|
||||
setup() {
|
||||
for (const reducer in reducers) {
|
||||
@@ -1035,9 +1870,9 @@ const element_plus_injection_plugin_1RNPi6ogby = /* @__PURE__ */ defineNuxtPlugi
|
||||
nuxtApp.vueApp.provide(ID_INJECTION_KEY, { "prefix": 1024, "current": 0 });
|
||||
});
|
||||
const plugins = [
|
||||
unhead_KgADcZ0jPj,
|
||||
unhead_JC77S3HdgF,
|
||||
plugin,
|
||||
revive_payload_server_eJ33V7gbc6,
|
||||
revive_payload_server_ncE5z6iePW,
|
||||
components_plugin_KR1HBZs4kY,
|
||||
element_plus_teleports_plugin_h4Dmekbj62,
|
||||
element_plus_injection_plugin_1RNPi6ogby
|
||||
@@ -1091,8 +1926,8 @@ const _sfc_main$1 = {
|
||||
const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
|
||||
const description = _error.message || _error.toString();
|
||||
const stack = void 0;
|
||||
const _Error404 = defineAsyncComponent(() => import('./_nuxt/error-404-GoZLlOqk.mjs').then((r) => r.default || r));
|
||||
const _Error = defineAsyncComponent(() => import('./_nuxt/error-500-FWApyVR9.mjs').then((r) => r.default || r));
|
||||
const _Error404 = defineAsyncComponent(() => import('./_nuxt/error-404-k0vLiug8.mjs').then((r) => r.default || r));
|
||||
const _Error = defineAsyncComponent(() => import('./_nuxt/error-500-G_5z8B0j.mjs').then((r) => r.default || r));
|
||||
const ErrorTemplate = is404 ? _Error404 : _Error;
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
|
||||
@@ -1102,7 +1937,7 @@ const _sfc_main$1 = {
|
||||
const _sfc_setup$1 = _sfc_main$1.setup;
|
||||
_sfc_main$1.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/.pnpm/nuxt@3.9.3_less@4.2.0_vite@5.0.12/node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
|
||||
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
||||
};
|
||||
const ErrorComponent = _sfc_main$1;
|
||||
@@ -1110,7 +1945,7 @@ const _sfc_main = {
|
||||
__name: "nuxt-root",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
const IslandRenderer = defineAsyncComponent(() => import('./_nuxt/island-renderer-UtbYqhWq.mjs').then((r) => r.default || r));
|
||||
const IslandRenderer = defineAsyncComponent(() => import('./_nuxt/island-renderer-B3KP16KS.mjs').then((r) => r.default || r));
|
||||
const nuxtApp = /* @__PURE__ */ useNuxtApp();
|
||||
nuxtApp.deferHydration();
|
||||
nuxtApp.ssrContext.url;
|
||||
@@ -1148,7 +1983,7 @@ const _sfc_main = {
|
||||
const _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/.pnpm/nuxt@3.9.3_less@4.2.0_vite@5.0.12/node_modules/nuxt/dist/app/components/nuxt-root.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
const RootComponent = _sfc_main;
|
||||
@@ -1172,5 +2007,26 @@ let entry;
|
||||
}
|
||||
const entry$1 = (ssrContext) => entry(ssrContext);
|
||||
|
||||
export { useRuntimeConfig as a, navigateTo as b, createError as c, useNamespace as d, entry$1 as default, useId as e, defaultNamespace as f, debugWarn as g, useRoute as h, useGetDerivedNamespace as i, useIdInjection as j, namespaceContextKey as k, injectHead as l, nuxtLinkDefaults as n, resolveUnrefHeadInput as r, throwError as t, useRouter as u };
|
||||
const server = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
a: useRuntimeConfig,
|
||||
b: navigateTo,
|
||||
c: createError,
|
||||
d: useNamespace,
|
||||
default: entry$1,
|
||||
e: useId,
|
||||
f: defaultNamespace,
|
||||
g: debugWarn,
|
||||
h: useRoute,
|
||||
i: useGetDerivedNamespace,
|
||||
j: useIdInjection,
|
||||
k: namespaceContextKey,
|
||||
l: injectHead,
|
||||
n: nuxtLinkDefaults,
|
||||
r: resolveUnrefHeadInput,
|
||||
t: throwError,
|
||||
u: useRouter
|
||||
});
|
||||
|
||||
export { useRouter as a, useId as b, useRoute as c, defaultNamespace as d, debugWarn as e, useGetDerivedNamespace as f, useIdInjection as g, hasProtocol as h, parseQuery as i, joinURL as j, nuxtLinkDefaults as k, useRuntimeConfig as l, navigateTo as m, namespaceContextKey as n, withoutTrailingSlash as o, parseURL as p, injectHead as q, resolveUnrefHeadInput as r, createError as s, throwError as t, useNamespace as u, server as v, withTrailingSlash as w };
|
||||
//# sourceMappingURL=server.mjs.map
|
||||
|
||||
Reference in New Issue
Block a user