@cooperco/nuxt-layer-base 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/package.json +7 -6
- package/.env +0 -10
- package/.nuxt/app.config.mjs +0 -21
- package/.nuxt/components.d.ts +0 -126
- package/.nuxt/dev/index.mjs +0 -3013
- package/.nuxt/dev/index.mjs.map +0 -1
- package/.nuxt/dist/server/client.manifest.mjs +0 -1
- package/.nuxt/dist/server/server.mjs +0 -1
- package/.nuxt/eslint-typegen.d.ts +0 -9474
- package/.nuxt/eslint.config.d.mts +0 -9
- package/.nuxt/eslint.config.mjs +0 -53
- package/.nuxt/i18n-route-resources.mjs +0 -3
- package/.nuxt/imports.d.ts +0 -34
- package/.nuxt/manifest/latest.json +0 -1
- package/.nuxt/manifest/meta/11e69554-8b10-4927-b475-a1b7f6b2bbac.json +0 -1
- package/.nuxt/manifest/meta/dev.json +0 -1
- package/.nuxt/nitro.json +0 -17
- package/.nuxt/nuxt.d.ts +0 -20
- package/.nuxt/nuxt.json +0 -9
- package/.nuxt/nuxt.node.d.ts +0 -13
- package/.nuxt/nuxt.shared.d.ts +0 -5
- package/.nuxt/schema/nuxt.schema.d.ts +0 -17
- package/.nuxt/schema/nuxt.schema.json +0 -3
- package/.nuxt/tsconfig.app.json +0 -226
- package/.nuxt/tsconfig.app.tsbuildinfo +0 -1
- package/.nuxt/tsconfig.json +0 -228
- package/.nuxt/tsconfig.node.json +0 -131
- package/.nuxt/tsconfig.node.tsbuildinfo +0 -1
- package/.nuxt/tsconfig.server.json +0 -162
- package/.nuxt/tsconfig.server.tsbuildinfo +0 -1
- package/.nuxt/tsconfig.shared.json +0 -182
- package/.nuxt/tsconfig.shared.tsbuildinfo +0 -1
- package/.nuxt/types/app.config.d.ts +0 -35
- package/.nuxt/types/build.d.ts +0 -25
- package/.nuxt/types/builder-env.d.ts +0 -1
- package/.nuxt/types/i18n-plugin.d.ts +0 -123
- package/.nuxt/types/imports.d.ts +0 -387
- package/.nuxt/types/middleware.d.ts +0 -11
- package/.nuxt/types/modules.d.ts +0 -87
- package/.nuxt/types/nitro-config.d.ts +0 -14
- package/.nuxt/types/nitro-imports.d.ts +0 -162
- package/.nuxt/types/nitro-nuxt.d.ts +0 -59
- package/.nuxt/types/nitro-routes.d.ts +0 -20
- package/.nuxt/types/nitro.d.ts +0 -3
- package/.nuxt/types/plugins.d.ts +0 -41
- package/.nuxt/types/runtime-config.d.ts +0 -102
- package/.nuxt/types/vue-shim.d.ts +0 -0
- package/Users//devin//AppData//Local//JetBrains//WebStorm2025.2//terminal//history//nuxt-layers-history +0 -736
- package/Users//devin//AppData//Local//JetBrains//WebStorm2025.2//terminal//history//nuxt-layers-history1 +0 -0
package/.nuxt/dev/index.mjs
DELETED
|
@@ -1,3013 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';globalThis._importMeta_={url:import.meta.url,env:process.env};import { tmpdir } from 'node:os';
|
|
2
|
-
import { defineEventHandler, handleCacheHeaders, splitCookiesString, createEvent, fetchWithEvent, isEvent, eventHandler, setHeaders, sendRedirect, proxyRequest, getRequestHeader, setResponseHeaders, setResponseStatus, send, getRequestHeaders, setResponseHeader, appendResponseHeader, getRequestURL, getResponseHeader, setCookie, removeResponseHeader, createError, getRouterParam, getQuery as getQuery$1, readBody, createApp, createRouter as createRouter$1, toNodeListener, lazyEventHandler, getResponseStatus, getResponseStatusText } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/h3/dist/index.mjs';
|
|
3
|
-
import { Server } from 'node:http';
|
|
4
|
-
import { resolve, dirname, join } from 'node:path';
|
|
5
|
-
import nodeCrypto from 'node:crypto';
|
|
6
|
-
import { parentPort, threadId } from 'node:worker_threads';
|
|
7
|
-
import { escapeHtml } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/@vue/shared/dist/shared.cjs.js';
|
|
8
|
-
import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/vue-bundle-renderer/dist/runtime.mjs';
|
|
9
|
-
import destr, { destr as destr$1 } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/destr/dist/index.mjs';
|
|
10
|
-
import { createHooks } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/hookable/dist/index.mjs';
|
|
11
|
-
import { createFetch, Headers as Headers$1 } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/ofetch/dist/node.mjs';
|
|
12
|
-
import { fetchNodeRequestHandler, callNodeRequestHandler } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/node-mock-http/dist/index.mjs';
|
|
13
|
-
import { createStorage, prefixStorage } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/unstorage/dist/index.mjs';
|
|
14
|
-
import unstorage_47drivers_47fs from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/unstorage/drivers/fs.mjs';
|
|
15
|
-
import { digest } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/ohash/dist/index.mjs';
|
|
16
|
-
import { klona } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/klona/dist/index.mjs';
|
|
17
|
-
import defu, { defuFn } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/defu/dist/defu.mjs';
|
|
18
|
-
import { snakeCase } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/scule/dist/index.mjs';
|
|
19
|
-
import { getContext } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/unctx/dist/index.mjs';
|
|
20
|
-
import { toRouteMatcher, createRouter } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/radix3/dist/index.mjs';
|
|
21
|
-
import { readFile } from 'node:fs/promises';
|
|
22
|
-
import consola, { consola as consola$1 } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/consola/dist/index.mjs';
|
|
23
|
-
import { ErrorParser } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/youch-core/build/index.js';
|
|
24
|
-
import { Youch } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/nitropack/node_modules/youch/build/index.js';
|
|
25
|
-
import { SourceMapConsumer } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/source-map/source-map.js';
|
|
26
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
27
|
-
import { stringify, uneval } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/devalue/index.js';
|
|
28
|
-
import { captureRawStackTrace, parseRawStackTrace } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/errx/dist/index.js';
|
|
29
|
-
import { isVNode, toValue, isRef } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/vue/index.mjs';
|
|
30
|
-
import { createPathIndexLanguageParser, parseAcceptLanguage } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/@intlify/utils/dist/index.mjs';
|
|
31
|
-
import { parse } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/cookie-es/dist/index.mjs';
|
|
32
|
-
import { createRouterMatcher } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/vue-router/dist/vue-router.node.mjs';
|
|
33
|
-
import { promises } from 'node:fs';
|
|
34
|
-
import { fileURLToPath } from 'node:url';
|
|
35
|
-
import { dirname as dirname$1, resolve as resolve$1 } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/pathe/dist/index.mjs';
|
|
36
|
-
import { createHead as createHead$1, propsToString, renderSSRHead } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/unhead/dist/server.mjs';
|
|
37
|
-
import { renderToString } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/vue/server-renderer/index.mjs';
|
|
38
|
-
import { walkResolver } from 'file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/node_modules/unhead/dist/utils.mjs';
|
|
39
|
-
|
|
40
|
-
const HASH_RE = /#/g;
|
|
41
|
-
const AMPERSAND_RE = /&/g;
|
|
42
|
-
const SLASH_RE = /\//g;
|
|
43
|
-
const EQUAL_RE = /=/g;
|
|
44
|
-
const PLUS_RE = /\+/g;
|
|
45
|
-
const ENC_CARET_RE = /%5e/gi;
|
|
46
|
-
const ENC_BACKTICK_RE = /%60/gi;
|
|
47
|
-
const ENC_PIPE_RE = /%7c/gi;
|
|
48
|
-
const ENC_SPACE_RE = /%20/gi;
|
|
49
|
-
const ENC_SLASH_RE = /%2f/gi;
|
|
50
|
-
function encode(text) {
|
|
51
|
-
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
52
|
-
}
|
|
53
|
-
function encodeQueryValue(input) {
|
|
54
|
-
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");
|
|
55
|
-
}
|
|
56
|
-
function encodeQueryKey(text) {
|
|
57
|
-
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
58
|
-
}
|
|
59
|
-
function decode(text = "") {
|
|
60
|
-
try {
|
|
61
|
-
return decodeURIComponent("" + text);
|
|
62
|
-
} catch {
|
|
63
|
-
return "" + text;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function decodePath(text) {
|
|
67
|
-
return decode(text.replace(ENC_SLASH_RE, "%252F"));
|
|
68
|
-
}
|
|
69
|
-
function decodeQueryKey(text) {
|
|
70
|
-
return decode(text.replace(PLUS_RE, " "));
|
|
71
|
-
}
|
|
72
|
-
function decodeQueryValue(text) {
|
|
73
|
-
return decode(text.replace(PLUS_RE, " "));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function parseQuery(parametersString = "") {
|
|
77
|
-
const object = /* @__PURE__ */ Object.create(null);
|
|
78
|
-
if (parametersString[0] === "?") {
|
|
79
|
-
parametersString = parametersString.slice(1);
|
|
80
|
-
}
|
|
81
|
-
for (const parameter of parametersString.split("&")) {
|
|
82
|
-
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
|
83
|
-
if (s.length < 2) {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const key = decodeQueryKey(s[1]);
|
|
87
|
-
if (key === "__proto__" || key === "constructor") {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
const value = decodeQueryValue(s[2] || "");
|
|
91
|
-
if (object[key] === void 0) {
|
|
92
|
-
object[key] = value;
|
|
93
|
-
} else if (Array.isArray(object[key])) {
|
|
94
|
-
object[key].push(value);
|
|
95
|
-
} else {
|
|
96
|
-
object[key] = [object[key], value];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return object;
|
|
100
|
-
}
|
|
101
|
-
function encodeQueryItem(key, value) {
|
|
102
|
-
if (typeof value === "number" || typeof value === "boolean") {
|
|
103
|
-
value = String(value);
|
|
104
|
-
}
|
|
105
|
-
if (!value) {
|
|
106
|
-
return encodeQueryKey(key);
|
|
107
|
-
}
|
|
108
|
-
if (Array.isArray(value)) {
|
|
109
|
-
return value.map(
|
|
110
|
-
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
|
|
111
|
-
).join("&");
|
|
112
|
-
}
|
|
113
|
-
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
114
|
-
}
|
|
115
|
-
function stringifyQuery(query) {
|
|
116
|
-
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
|
120
|
-
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
|
121
|
-
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
|
122
|
-
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
123
|
-
function hasProtocol(inputString, opts = {}) {
|
|
124
|
-
if (typeof opts === "boolean") {
|
|
125
|
-
opts = { acceptRelative: opts };
|
|
126
|
-
}
|
|
127
|
-
if (opts.strict) {
|
|
128
|
-
return PROTOCOL_STRICT_REGEX.test(inputString);
|
|
129
|
-
}
|
|
130
|
-
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
|
131
|
-
}
|
|
132
|
-
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
133
|
-
{
|
|
134
|
-
return input.endsWith("/");
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
|
138
|
-
{
|
|
139
|
-
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
143
|
-
{
|
|
144
|
-
return input.endsWith("/") ? input : input + "/";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function hasLeadingSlash(input = "") {
|
|
148
|
-
return input.startsWith("/");
|
|
149
|
-
}
|
|
150
|
-
function withLeadingSlash(input = "") {
|
|
151
|
-
return hasLeadingSlash(input) ? input : "/" + input;
|
|
152
|
-
}
|
|
153
|
-
function withoutBase(input, base) {
|
|
154
|
-
if (isEmptyURL(base)) {
|
|
155
|
-
return input;
|
|
156
|
-
}
|
|
157
|
-
const _base = withoutTrailingSlash(base);
|
|
158
|
-
if (!input.startsWith(_base)) {
|
|
159
|
-
return input;
|
|
160
|
-
}
|
|
161
|
-
const trimmed = input.slice(_base.length);
|
|
162
|
-
return trimmed[0] === "/" ? trimmed : "/" + trimmed;
|
|
163
|
-
}
|
|
164
|
-
function withQuery(input, query) {
|
|
165
|
-
const parsed = parseURL(input);
|
|
166
|
-
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
|
167
|
-
parsed.search = stringifyQuery(mergedQuery);
|
|
168
|
-
return stringifyParsedURL(parsed);
|
|
169
|
-
}
|
|
170
|
-
function getQuery(input) {
|
|
171
|
-
return parseQuery(parseURL(input).search);
|
|
172
|
-
}
|
|
173
|
-
function isEmptyURL(url) {
|
|
174
|
-
return !url || url === "/";
|
|
175
|
-
}
|
|
176
|
-
function isNonEmptyURL(url) {
|
|
177
|
-
return url && url !== "/";
|
|
178
|
-
}
|
|
179
|
-
function joinURL(base, ...input) {
|
|
180
|
-
let url = base || "";
|
|
181
|
-
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
|
|
182
|
-
if (url) {
|
|
183
|
-
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
|
|
184
|
-
url = withTrailingSlash(url) + _segment;
|
|
185
|
-
} else {
|
|
186
|
-
url = segment;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return url;
|
|
190
|
-
}
|
|
191
|
-
function joinRelativeURL(..._input) {
|
|
192
|
-
const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
|
|
193
|
-
const input = _input.filter(Boolean);
|
|
194
|
-
const segments = [];
|
|
195
|
-
let segmentsDepth = 0;
|
|
196
|
-
for (const i of input) {
|
|
197
|
-
if (!i || i === "/") {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
|
|
201
|
-
if (!s || s === ".") {
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
if (s === "..") {
|
|
205
|
-
if (segments.length === 1 && hasProtocol(segments[0])) {
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
segments.pop();
|
|
209
|
-
segmentsDepth--;
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
|
|
213
|
-
segments[segments.length - 1] += "/" + s;
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
segments.push(s);
|
|
217
|
-
segmentsDepth++;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
let url = segments.join("/");
|
|
221
|
-
if (segmentsDepth >= 0) {
|
|
222
|
-
if (input[0]?.startsWith("/") && !url.startsWith("/")) {
|
|
223
|
-
url = "/" + url;
|
|
224
|
-
} else if (input[0]?.startsWith("./") && !url.startsWith("./")) {
|
|
225
|
-
url = "./" + url;
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
url = "../".repeat(-1 * segmentsDepth) + url;
|
|
229
|
-
}
|
|
230
|
-
if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) {
|
|
231
|
-
url += "/";
|
|
232
|
-
}
|
|
233
|
-
return url;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
237
|
-
function parseURL(input = "", defaultProto) {
|
|
238
|
-
const _specialProtoMatch = input.match(
|
|
239
|
-
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
|
|
240
|
-
);
|
|
241
|
-
if (_specialProtoMatch) {
|
|
242
|
-
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
|
243
|
-
return {
|
|
244
|
-
protocol: _proto.toLowerCase(),
|
|
245
|
-
pathname: _pathname,
|
|
246
|
-
href: _proto + _pathname,
|
|
247
|
-
auth: "",
|
|
248
|
-
host: "",
|
|
249
|
-
search: "",
|
|
250
|
-
hash: ""
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
if (!hasProtocol(input, { acceptRelative: true })) {
|
|
254
|
-
return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
|
|
255
|
-
}
|
|
256
|
-
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
|
257
|
-
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
|
258
|
-
if (protocol === "file:") {
|
|
259
|
-
path = path.replace(/\/(?=[A-Za-z]:)/, "");
|
|
260
|
-
}
|
|
261
|
-
const { pathname, search, hash } = parsePath(path);
|
|
262
|
-
return {
|
|
263
|
-
protocol: protocol.toLowerCase(),
|
|
264
|
-
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
|
265
|
-
host,
|
|
266
|
-
pathname,
|
|
267
|
-
search,
|
|
268
|
-
hash,
|
|
269
|
-
[protocolRelative]: !protocol
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function parsePath(input = "") {
|
|
273
|
-
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
|
274
|
-
return {
|
|
275
|
-
pathname,
|
|
276
|
-
search,
|
|
277
|
-
hash
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function stringifyParsedURL(parsed) {
|
|
281
|
-
const pathname = parsed.pathname || "";
|
|
282
|
-
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
|
283
|
-
const hash = parsed.hash || "";
|
|
284
|
-
const auth = parsed.auth ? parsed.auth + "@" : "";
|
|
285
|
-
const host = parsed.host || "";
|
|
286
|
-
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
|
|
287
|
-
return proto + auth + host + pathname + search + hash;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const serverAssets = [{"baseName":"server","dir":"/home/devin/projects/Cryobank/nuxt-layers/layers/base/server/assets"}];
|
|
291
|
-
|
|
292
|
-
const assets$1 = createStorage();
|
|
293
|
-
|
|
294
|
-
for (const asset of serverAssets) {
|
|
295
|
-
assets$1.mount(asset.baseName, unstorage_47drivers_47fs({ base: asset.dir, ignore: (asset?.ignore || []) }));
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
const storage$1 = createStorage({});
|
|
299
|
-
|
|
300
|
-
storage$1.mount('/assets', assets$1);
|
|
301
|
-
|
|
302
|
-
storage$1.mount('root', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/home/devin/projects/Cryobank/nuxt-layers/layers/base","watchOptions":{"ignored":[null]}}));
|
|
303
|
-
storage$1.mount('src', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/home/devin/projects/Cryobank/nuxt-layers/layers/base/server","watchOptions":{"ignored":[null]}}));
|
|
304
|
-
storage$1.mount('build', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/home/devin/projects/Cryobank/nuxt-layers/layers/base/.nuxt"}));
|
|
305
|
-
storage$1.mount('cache', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/home/devin/projects/Cryobank/nuxt-layers/layers/base/.nuxt/cache"}));
|
|
306
|
-
storage$1.mount('data', unstorage_47drivers_47fs({"driver":"fs","base":"/home/devin/projects/Cryobank/nuxt-layers/layers/base/.data/kv"}));
|
|
307
|
-
|
|
308
|
-
function useStorage(base = "") {
|
|
309
|
-
return base ? prefixStorage(storage$1, base) : storage$1;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const Hasher = /* @__PURE__ */ (() => {
|
|
313
|
-
class Hasher2 {
|
|
314
|
-
buff = "";
|
|
315
|
-
#context = /* @__PURE__ */ new Map();
|
|
316
|
-
write(str) {
|
|
317
|
-
this.buff += str;
|
|
318
|
-
}
|
|
319
|
-
dispatch(value) {
|
|
320
|
-
const type = value === null ? "null" : typeof value;
|
|
321
|
-
return this[type](value);
|
|
322
|
-
}
|
|
323
|
-
object(object) {
|
|
324
|
-
if (object && typeof object.toJSON === "function") {
|
|
325
|
-
return this.object(object.toJSON());
|
|
326
|
-
}
|
|
327
|
-
const objString = Object.prototype.toString.call(object);
|
|
328
|
-
let objType = "";
|
|
329
|
-
const objectLength = objString.length;
|
|
330
|
-
objType = objectLength < 10 ? "unknown:[" + objString + "]" : objString.slice(8, objectLength - 1);
|
|
331
|
-
objType = objType.toLowerCase();
|
|
332
|
-
let objectNumber = null;
|
|
333
|
-
if ((objectNumber = this.#context.get(object)) === void 0) {
|
|
334
|
-
this.#context.set(object, this.#context.size);
|
|
335
|
-
} else {
|
|
336
|
-
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
|
|
337
|
-
}
|
|
338
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
|
|
339
|
-
this.write("buffer:");
|
|
340
|
-
return this.write(object.toString("utf8"));
|
|
341
|
-
}
|
|
342
|
-
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
|
|
343
|
-
if (this[objType]) {
|
|
344
|
-
this[objType](object);
|
|
345
|
-
} else {
|
|
346
|
-
this.unknown(object, objType);
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
const keys = Object.keys(object).sort();
|
|
350
|
-
const extraKeys = [];
|
|
351
|
-
this.write("object:" + (keys.length + extraKeys.length) + ":");
|
|
352
|
-
const dispatchForKey = (key) => {
|
|
353
|
-
this.dispatch(key);
|
|
354
|
-
this.write(":");
|
|
355
|
-
this.dispatch(object[key]);
|
|
356
|
-
this.write(",");
|
|
357
|
-
};
|
|
358
|
-
for (const key of keys) {
|
|
359
|
-
dispatchForKey(key);
|
|
360
|
-
}
|
|
361
|
-
for (const key of extraKeys) {
|
|
362
|
-
dispatchForKey(key);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
array(arr, unordered) {
|
|
367
|
-
unordered = unordered === void 0 ? false : unordered;
|
|
368
|
-
this.write("array:" + arr.length + ":");
|
|
369
|
-
if (!unordered || arr.length <= 1) {
|
|
370
|
-
for (const entry of arr) {
|
|
371
|
-
this.dispatch(entry);
|
|
372
|
-
}
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const contextAdditions = /* @__PURE__ */ new Map();
|
|
376
|
-
const entries = arr.map((entry) => {
|
|
377
|
-
const hasher = new Hasher2();
|
|
378
|
-
hasher.dispatch(entry);
|
|
379
|
-
for (const [key, value] of hasher.#context) {
|
|
380
|
-
contextAdditions.set(key, value);
|
|
381
|
-
}
|
|
382
|
-
return hasher.toString();
|
|
383
|
-
});
|
|
384
|
-
this.#context = contextAdditions;
|
|
385
|
-
entries.sort();
|
|
386
|
-
return this.array(entries, false);
|
|
387
|
-
}
|
|
388
|
-
date(date) {
|
|
389
|
-
return this.write("date:" + date.toJSON());
|
|
390
|
-
}
|
|
391
|
-
symbol(sym) {
|
|
392
|
-
return this.write("symbol:" + sym.toString());
|
|
393
|
-
}
|
|
394
|
-
unknown(value, type) {
|
|
395
|
-
this.write(type);
|
|
396
|
-
if (!value) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
this.write(":");
|
|
400
|
-
if (value && typeof value.entries === "function") {
|
|
401
|
-
return this.array(
|
|
402
|
-
[...value.entries()],
|
|
403
|
-
true
|
|
404
|
-
/* ordered */
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
error(err) {
|
|
409
|
-
return this.write("error:" + err.toString());
|
|
410
|
-
}
|
|
411
|
-
boolean(bool) {
|
|
412
|
-
return this.write("bool:" + bool);
|
|
413
|
-
}
|
|
414
|
-
string(string) {
|
|
415
|
-
this.write("string:" + string.length + ":");
|
|
416
|
-
this.write(string);
|
|
417
|
-
}
|
|
418
|
-
function(fn) {
|
|
419
|
-
this.write("fn:");
|
|
420
|
-
if (isNativeFunction(fn)) {
|
|
421
|
-
this.dispatch("[native]");
|
|
422
|
-
} else {
|
|
423
|
-
this.dispatch(fn.toString());
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
number(number) {
|
|
427
|
-
return this.write("number:" + number);
|
|
428
|
-
}
|
|
429
|
-
null() {
|
|
430
|
-
return this.write("Null");
|
|
431
|
-
}
|
|
432
|
-
undefined() {
|
|
433
|
-
return this.write("Undefined");
|
|
434
|
-
}
|
|
435
|
-
regexp(regex) {
|
|
436
|
-
return this.write("regex:" + regex.toString());
|
|
437
|
-
}
|
|
438
|
-
arraybuffer(arr) {
|
|
439
|
-
this.write("arraybuffer:");
|
|
440
|
-
return this.dispatch(new Uint8Array(arr));
|
|
441
|
-
}
|
|
442
|
-
url(url) {
|
|
443
|
-
return this.write("url:" + url.toString());
|
|
444
|
-
}
|
|
445
|
-
map(map) {
|
|
446
|
-
this.write("map:");
|
|
447
|
-
const arr = [...map];
|
|
448
|
-
return this.array(arr, false);
|
|
449
|
-
}
|
|
450
|
-
set(set) {
|
|
451
|
-
this.write("set:");
|
|
452
|
-
const arr = [...set];
|
|
453
|
-
return this.array(arr, false);
|
|
454
|
-
}
|
|
455
|
-
bigint(number) {
|
|
456
|
-
return this.write("bigint:" + number.toString());
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
for (const type of [
|
|
460
|
-
"uint8array",
|
|
461
|
-
"uint8clampedarray",
|
|
462
|
-
"unt8array",
|
|
463
|
-
"uint16array",
|
|
464
|
-
"unt16array",
|
|
465
|
-
"uint32array",
|
|
466
|
-
"unt32array",
|
|
467
|
-
"float32array",
|
|
468
|
-
"float64array"
|
|
469
|
-
]) {
|
|
470
|
-
Hasher2.prototype[type] = function(arr) {
|
|
471
|
-
this.write(type + ":");
|
|
472
|
-
return this.array([...arr], false);
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
function isNativeFunction(f) {
|
|
476
|
-
if (typeof f !== "function") {
|
|
477
|
-
return false;
|
|
478
|
-
}
|
|
479
|
-
return Function.prototype.toString.call(f).slice(
|
|
480
|
-
-15
|
|
481
|
-
/* "[native code] }".length */
|
|
482
|
-
) === "[native code] }";
|
|
483
|
-
}
|
|
484
|
-
return Hasher2;
|
|
485
|
-
})();
|
|
486
|
-
function serialize(object) {
|
|
487
|
-
const hasher = new Hasher();
|
|
488
|
-
hasher.dispatch(object);
|
|
489
|
-
return hasher.buff;
|
|
490
|
-
}
|
|
491
|
-
function hash(value) {
|
|
492
|
-
return digest(typeof value === "string" ? value : serialize(value)).replace(/[-_]/g, "").slice(0, 10);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function defaultCacheOptions() {
|
|
496
|
-
return {
|
|
497
|
-
name: "_",
|
|
498
|
-
base: "/cache",
|
|
499
|
-
swr: true,
|
|
500
|
-
maxAge: 1
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
function defineCachedFunction(fn, opts = {}) {
|
|
504
|
-
opts = { ...defaultCacheOptions(), ...opts };
|
|
505
|
-
const pending = {};
|
|
506
|
-
const group = opts.group || "nitro/functions";
|
|
507
|
-
const name = opts.name || fn.name || "_";
|
|
508
|
-
const integrity = opts.integrity || hash([fn, opts]);
|
|
509
|
-
const validate = opts.validate || ((entry) => entry.value !== void 0);
|
|
510
|
-
async function get(key, resolver, shouldInvalidateCache, event) {
|
|
511
|
-
const cacheKey = [opts.base, group, name, key + ".json"].filter(Boolean).join(":").replace(/:\/$/, ":index");
|
|
512
|
-
let entry = await useStorage().getItem(cacheKey).catch((error) => {
|
|
513
|
-
console.error(`[cache] Cache read error.`, error);
|
|
514
|
-
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
515
|
-
}) || {};
|
|
516
|
-
if (typeof entry !== "object") {
|
|
517
|
-
entry = {};
|
|
518
|
-
const error = new Error("Malformed data read from cache.");
|
|
519
|
-
console.error("[cache]", error);
|
|
520
|
-
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
521
|
-
}
|
|
522
|
-
const ttl = (opts.maxAge ?? 0) * 1e3;
|
|
523
|
-
if (ttl) {
|
|
524
|
-
entry.expires = Date.now() + ttl;
|
|
525
|
-
}
|
|
526
|
-
const expired = shouldInvalidateCache || entry.integrity !== integrity || ttl && Date.now() - (entry.mtime || 0) > ttl || validate(entry) === false;
|
|
527
|
-
const _resolve = async () => {
|
|
528
|
-
const isPending = pending[key];
|
|
529
|
-
if (!isPending) {
|
|
530
|
-
if (entry.value !== void 0 && (opts.staleMaxAge || 0) >= 0 && opts.swr === false) {
|
|
531
|
-
entry.value = void 0;
|
|
532
|
-
entry.integrity = void 0;
|
|
533
|
-
entry.mtime = void 0;
|
|
534
|
-
entry.expires = void 0;
|
|
535
|
-
}
|
|
536
|
-
pending[key] = Promise.resolve(resolver());
|
|
537
|
-
}
|
|
538
|
-
try {
|
|
539
|
-
entry.value = await pending[key];
|
|
540
|
-
} catch (error) {
|
|
541
|
-
if (!isPending) {
|
|
542
|
-
delete pending[key];
|
|
543
|
-
}
|
|
544
|
-
throw error;
|
|
545
|
-
}
|
|
546
|
-
if (!isPending) {
|
|
547
|
-
entry.mtime = Date.now();
|
|
548
|
-
entry.integrity = integrity;
|
|
549
|
-
delete pending[key];
|
|
550
|
-
if (validate(entry) !== false) {
|
|
551
|
-
let setOpts;
|
|
552
|
-
if (opts.maxAge && !opts.swr) {
|
|
553
|
-
setOpts = { ttl: opts.maxAge };
|
|
554
|
-
}
|
|
555
|
-
const promise = useStorage().setItem(cacheKey, entry, setOpts).catch((error) => {
|
|
556
|
-
console.error(`[cache] Cache write error.`, error);
|
|
557
|
-
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
558
|
-
});
|
|
559
|
-
if (event?.waitUntil) {
|
|
560
|
-
event.waitUntil(promise);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
const _resolvePromise = expired ? _resolve() : Promise.resolve();
|
|
566
|
-
if (entry.value === void 0) {
|
|
567
|
-
await _resolvePromise;
|
|
568
|
-
} else if (expired && event && event.waitUntil) {
|
|
569
|
-
event.waitUntil(_resolvePromise);
|
|
570
|
-
}
|
|
571
|
-
if (opts.swr && validate(entry) !== false) {
|
|
572
|
-
_resolvePromise.catch((error) => {
|
|
573
|
-
console.error(`[cache] SWR handler error.`, error);
|
|
574
|
-
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
575
|
-
});
|
|
576
|
-
return entry;
|
|
577
|
-
}
|
|
578
|
-
return _resolvePromise.then(() => entry);
|
|
579
|
-
}
|
|
580
|
-
return async (...args) => {
|
|
581
|
-
const shouldBypassCache = await opts.shouldBypassCache?.(...args);
|
|
582
|
-
if (shouldBypassCache) {
|
|
583
|
-
return fn(...args);
|
|
584
|
-
}
|
|
585
|
-
const key = await (opts.getKey || getKey)(...args);
|
|
586
|
-
const shouldInvalidateCache = await opts.shouldInvalidateCache?.(...args);
|
|
587
|
-
const entry = await get(
|
|
588
|
-
key,
|
|
589
|
-
() => fn(...args),
|
|
590
|
-
shouldInvalidateCache,
|
|
591
|
-
args[0] && isEvent(args[0]) ? args[0] : void 0
|
|
592
|
-
);
|
|
593
|
-
let value = entry.value;
|
|
594
|
-
if (opts.transform) {
|
|
595
|
-
value = await opts.transform(entry, ...args) || value;
|
|
596
|
-
}
|
|
597
|
-
return value;
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
function cachedFunction(fn, opts = {}) {
|
|
601
|
-
return defineCachedFunction(fn, opts);
|
|
602
|
-
}
|
|
603
|
-
function getKey(...args) {
|
|
604
|
-
return args.length > 0 ? hash(args) : "";
|
|
605
|
-
}
|
|
606
|
-
function escapeKey(key) {
|
|
607
|
-
return String(key).replace(/\W/g, "");
|
|
608
|
-
}
|
|
609
|
-
function defineCachedEventHandler(handler, opts = defaultCacheOptions()) {
|
|
610
|
-
const variableHeaderNames = (opts.varies || []).filter(Boolean).map((h) => h.toLowerCase()).sort();
|
|
611
|
-
const _opts = {
|
|
612
|
-
...opts,
|
|
613
|
-
getKey: async (event) => {
|
|
614
|
-
const customKey = await opts.getKey?.(event);
|
|
615
|
-
if (customKey) {
|
|
616
|
-
return escapeKey(customKey);
|
|
617
|
-
}
|
|
618
|
-
const _path = event.node.req.originalUrl || event.node.req.url || event.path;
|
|
619
|
-
let _pathname;
|
|
620
|
-
try {
|
|
621
|
-
_pathname = escapeKey(decodeURI(parseURL(_path).pathname)).slice(0, 16) || "index";
|
|
622
|
-
} catch {
|
|
623
|
-
_pathname = "-";
|
|
624
|
-
}
|
|
625
|
-
const _hashedPath = `${_pathname}.${hash(_path)}`;
|
|
626
|
-
const _headers = variableHeaderNames.map((header) => [header, event.node.req.headers[header]]).map(([name, value]) => `${escapeKey(name)}.${hash(value)}`);
|
|
627
|
-
return [_hashedPath, ..._headers].join(":");
|
|
628
|
-
},
|
|
629
|
-
validate: (entry) => {
|
|
630
|
-
if (!entry.value) {
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
|
-
if (entry.value.code >= 400) {
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
if (entry.value.body === void 0) {
|
|
637
|
-
return false;
|
|
638
|
-
}
|
|
639
|
-
if (entry.value.headers.etag === "undefined" || entry.value.headers["last-modified"] === "undefined") {
|
|
640
|
-
return false;
|
|
641
|
-
}
|
|
642
|
-
return true;
|
|
643
|
-
},
|
|
644
|
-
group: opts.group || "nitro/handlers",
|
|
645
|
-
integrity: opts.integrity || hash([handler, opts])
|
|
646
|
-
};
|
|
647
|
-
const _cachedHandler = cachedFunction(
|
|
648
|
-
async (incomingEvent) => {
|
|
649
|
-
const variableHeaders = {};
|
|
650
|
-
for (const header of variableHeaderNames) {
|
|
651
|
-
const value = incomingEvent.node.req.headers[header];
|
|
652
|
-
if (value !== void 0) {
|
|
653
|
-
variableHeaders[header] = value;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
const reqProxy = cloneWithProxy(incomingEvent.node.req, {
|
|
657
|
-
headers: variableHeaders
|
|
658
|
-
});
|
|
659
|
-
const resHeaders = {};
|
|
660
|
-
let _resSendBody;
|
|
661
|
-
const resProxy = cloneWithProxy(incomingEvent.node.res, {
|
|
662
|
-
statusCode: 200,
|
|
663
|
-
writableEnded: false,
|
|
664
|
-
writableFinished: false,
|
|
665
|
-
headersSent: false,
|
|
666
|
-
closed: false,
|
|
667
|
-
getHeader(name) {
|
|
668
|
-
return resHeaders[name];
|
|
669
|
-
},
|
|
670
|
-
setHeader(name, value) {
|
|
671
|
-
resHeaders[name] = value;
|
|
672
|
-
return this;
|
|
673
|
-
},
|
|
674
|
-
getHeaderNames() {
|
|
675
|
-
return Object.keys(resHeaders);
|
|
676
|
-
},
|
|
677
|
-
hasHeader(name) {
|
|
678
|
-
return name in resHeaders;
|
|
679
|
-
},
|
|
680
|
-
removeHeader(name) {
|
|
681
|
-
delete resHeaders[name];
|
|
682
|
-
},
|
|
683
|
-
getHeaders() {
|
|
684
|
-
return resHeaders;
|
|
685
|
-
},
|
|
686
|
-
end(chunk, arg2, arg3) {
|
|
687
|
-
if (typeof chunk === "string") {
|
|
688
|
-
_resSendBody = chunk;
|
|
689
|
-
}
|
|
690
|
-
if (typeof arg2 === "function") {
|
|
691
|
-
arg2();
|
|
692
|
-
}
|
|
693
|
-
if (typeof arg3 === "function") {
|
|
694
|
-
arg3();
|
|
695
|
-
}
|
|
696
|
-
return this;
|
|
697
|
-
},
|
|
698
|
-
write(chunk, arg2, arg3) {
|
|
699
|
-
if (typeof chunk === "string") {
|
|
700
|
-
_resSendBody = chunk;
|
|
701
|
-
}
|
|
702
|
-
if (typeof arg2 === "function") {
|
|
703
|
-
arg2(void 0);
|
|
704
|
-
}
|
|
705
|
-
if (typeof arg3 === "function") {
|
|
706
|
-
arg3();
|
|
707
|
-
}
|
|
708
|
-
return true;
|
|
709
|
-
},
|
|
710
|
-
writeHead(statusCode, headers2) {
|
|
711
|
-
this.statusCode = statusCode;
|
|
712
|
-
if (headers2) {
|
|
713
|
-
if (Array.isArray(headers2) || typeof headers2 === "string") {
|
|
714
|
-
throw new TypeError("Raw headers is not supported.");
|
|
715
|
-
}
|
|
716
|
-
for (const header in headers2) {
|
|
717
|
-
const value = headers2[header];
|
|
718
|
-
if (value !== void 0) {
|
|
719
|
-
this.setHeader(
|
|
720
|
-
header,
|
|
721
|
-
value
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
return this;
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
const event = createEvent(reqProxy, resProxy);
|
|
730
|
-
event.fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
|
|
731
|
-
fetch: useNitroApp().localFetch
|
|
732
|
-
});
|
|
733
|
-
event.$fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
|
|
734
|
-
fetch: globalThis.$fetch
|
|
735
|
-
});
|
|
736
|
-
event.waitUntil = incomingEvent.waitUntil;
|
|
737
|
-
event.context = incomingEvent.context;
|
|
738
|
-
event.context.cache = {
|
|
739
|
-
options: _opts
|
|
740
|
-
};
|
|
741
|
-
const body = await handler(event) || _resSendBody;
|
|
742
|
-
const headers = event.node.res.getHeaders();
|
|
743
|
-
headers.etag = String(
|
|
744
|
-
headers.Etag || headers.etag || `W/"${hash(body)}"`
|
|
745
|
-
);
|
|
746
|
-
headers["last-modified"] = String(
|
|
747
|
-
headers["Last-Modified"] || headers["last-modified"] || (/* @__PURE__ */ new Date()).toUTCString()
|
|
748
|
-
);
|
|
749
|
-
const cacheControl = [];
|
|
750
|
-
if (opts.swr) {
|
|
751
|
-
if (opts.maxAge) {
|
|
752
|
-
cacheControl.push(`s-maxage=${opts.maxAge}`);
|
|
753
|
-
}
|
|
754
|
-
if (opts.staleMaxAge) {
|
|
755
|
-
cacheControl.push(`stale-while-revalidate=${opts.staleMaxAge}`);
|
|
756
|
-
} else {
|
|
757
|
-
cacheControl.push("stale-while-revalidate");
|
|
758
|
-
}
|
|
759
|
-
} else if (opts.maxAge) {
|
|
760
|
-
cacheControl.push(`max-age=${opts.maxAge}`);
|
|
761
|
-
}
|
|
762
|
-
if (cacheControl.length > 0) {
|
|
763
|
-
headers["cache-control"] = cacheControl.join(", ");
|
|
764
|
-
}
|
|
765
|
-
const cacheEntry = {
|
|
766
|
-
code: event.node.res.statusCode,
|
|
767
|
-
headers,
|
|
768
|
-
body
|
|
769
|
-
};
|
|
770
|
-
return cacheEntry;
|
|
771
|
-
},
|
|
772
|
-
_opts
|
|
773
|
-
);
|
|
774
|
-
return defineEventHandler(async (event) => {
|
|
775
|
-
if (opts.headersOnly) {
|
|
776
|
-
if (handleCacheHeaders(event, { maxAge: opts.maxAge })) {
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
return handler(event);
|
|
780
|
-
}
|
|
781
|
-
const response = await _cachedHandler(
|
|
782
|
-
event
|
|
783
|
-
);
|
|
784
|
-
if (event.node.res.headersSent || event.node.res.writableEnded) {
|
|
785
|
-
return response.body;
|
|
786
|
-
}
|
|
787
|
-
if (handleCacheHeaders(event, {
|
|
788
|
-
modifiedTime: new Date(response.headers["last-modified"]),
|
|
789
|
-
etag: response.headers.etag,
|
|
790
|
-
maxAge: opts.maxAge
|
|
791
|
-
})) {
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
794
|
-
event.node.res.statusCode = response.code;
|
|
795
|
-
for (const name in response.headers) {
|
|
796
|
-
const value = response.headers[name];
|
|
797
|
-
if (name === "set-cookie") {
|
|
798
|
-
event.node.res.appendHeader(
|
|
799
|
-
name,
|
|
800
|
-
splitCookiesString(value)
|
|
801
|
-
);
|
|
802
|
-
} else {
|
|
803
|
-
if (value !== void 0) {
|
|
804
|
-
event.node.res.setHeader(name, value);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
return response.body;
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
function cloneWithProxy(obj, overrides) {
|
|
812
|
-
return new Proxy(obj, {
|
|
813
|
-
get(target, property, receiver) {
|
|
814
|
-
if (property in overrides) {
|
|
815
|
-
return overrides[property];
|
|
816
|
-
}
|
|
817
|
-
return Reflect.get(target, property, receiver);
|
|
818
|
-
},
|
|
819
|
-
set(target, property, value, receiver) {
|
|
820
|
-
if (property in overrides) {
|
|
821
|
-
overrides[property] = value;
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
return Reflect.set(target, property, value, receiver);
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
const cachedEventHandler = defineCachedEventHandler;
|
|
829
|
-
|
|
830
|
-
const inlineAppConfig = {
|
|
831
|
-
"nuxt": {}
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
const appConfig = defuFn(inlineAppConfig);
|
|
837
|
-
|
|
838
|
-
function getEnv(key, opts) {
|
|
839
|
-
const envKey = snakeCase(key).toUpperCase();
|
|
840
|
-
return destr(
|
|
841
|
-
process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey]
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
function _isObject(input) {
|
|
845
|
-
return typeof input === "object" && !Array.isArray(input);
|
|
846
|
-
}
|
|
847
|
-
function applyEnv(obj, opts, parentKey = "") {
|
|
848
|
-
for (const key in obj) {
|
|
849
|
-
const subKey = parentKey ? `${parentKey}_${key}` : key;
|
|
850
|
-
const envValue = getEnv(subKey, opts);
|
|
851
|
-
if (_isObject(obj[key])) {
|
|
852
|
-
if (_isObject(envValue)) {
|
|
853
|
-
obj[key] = { ...obj[key], ...envValue };
|
|
854
|
-
applyEnv(obj[key], opts, subKey);
|
|
855
|
-
} else if (envValue === void 0) {
|
|
856
|
-
applyEnv(obj[key], opts, subKey);
|
|
857
|
-
} else {
|
|
858
|
-
obj[key] = envValue ?? obj[key];
|
|
859
|
-
}
|
|
860
|
-
} else {
|
|
861
|
-
obj[key] = envValue ?? obj[key];
|
|
862
|
-
}
|
|
863
|
-
if (opts.envExpansion && typeof obj[key] === "string") {
|
|
864
|
-
obj[key] = _expandFromEnv(obj[key]);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
return obj;
|
|
868
|
-
}
|
|
869
|
-
const envExpandRx = /\{\{([^{}]*)\}\}/g;
|
|
870
|
-
function _expandFromEnv(value) {
|
|
871
|
-
return value.replace(envExpandRx, (match, key) => {
|
|
872
|
-
return process.env[key] || match;
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
const _inlineRuntimeConfig = {
|
|
877
|
-
"app": {
|
|
878
|
-
"baseURL": "/",
|
|
879
|
-
"buildId": "dev",
|
|
880
|
-
"buildAssetsDir": "/_nuxt/",
|
|
881
|
-
"cdnURL": ""
|
|
882
|
-
},
|
|
883
|
-
"nitro": {
|
|
884
|
-
"envPrefix": "NUXT_",
|
|
885
|
-
"routeRules": {
|
|
886
|
-
"/__nuxt_error": {
|
|
887
|
-
"cache": false
|
|
888
|
-
},
|
|
889
|
-
"/_nuxt/builds/meta/**": {
|
|
890
|
-
"headers": {
|
|
891
|
-
"cache-control": "public, max-age=31536000, immutable"
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
|
-
"/_nuxt/builds/**": {
|
|
895
|
-
"headers": {
|
|
896
|
-
"cache-control": "public, max-age=1, immutable"
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
},
|
|
901
|
-
"public": {
|
|
902
|
-
"logglyEnabled": false,
|
|
903
|
-
"logglyTags": [
|
|
904
|
-
"nuxt",
|
|
905
|
-
"base"
|
|
906
|
-
],
|
|
907
|
-
"logLevel": "error",
|
|
908
|
-
"i18n": {
|
|
909
|
-
"baseUrl": "",
|
|
910
|
-
"defaultLocale": "enUS",
|
|
911
|
-
"rootRedirect": "",
|
|
912
|
-
"redirectStatusCode": 302,
|
|
913
|
-
"skipSettingLocaleOnNavigate": false,
|
|
914
|
-
"locales": [
|
|
915
|
-
{
|
|
916
|
-
"code": "enUS",
|
|
917
|
-
"language": "en-US"
|
|
918
|
-
}
|
|
919
|
-
],
|
|
920
|
-
"detectBrowserLanguage": {
|
|
921
|
-
"alwaysRedirect": false,
|
|
922
|
-
"cookieCrossOrigin": false,
|
|
923
|
-
"cookieDomain": "",
|
|
924
|
-
"cookieKey": "i18n_redirected",
|
|
925
|
-
"cookieSecure": false,
|
|
926
|
-
"fallbackLocale": "",
|
|
927
|
-
"redirectOn": "root",
|
|
928
|
-
"useCookie": true
|
|
929
|
-
},
|
|
930
|
-
"experimental": {
|
|
931
|
-
"localeDetector": "",
|
|
932
|
-
"typedPages": true,
|
|
933
|
-
"typedOptionsAndMessages": false,
|
|
934
|
-
"alternateLinkCanonicalQueries": true,
|
|
935
|
-
"devCache": false,
|
|
936
|
-
"cacheLifetime": "",
|
|
937
|
-
"stripMessagesPayload": false,
|
|
938
|
-
"preload": false,
|
|
939
|
-
"strictSeo": false,
|
|
940
|
-
"nitroContextDetection": true
|
|
941
|
-
},
|
|
942
|
-
"domainLocales": {
|
|
943
|
-
"enUS": {
|
|
944
|
-
"domain": ""
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
},
|
|
949
|
-
"logglyToken": "",
|
|
950
|
-
"logglyEndpoint": "https://logs-01.loggly.com/inputs"
|
|
951
|
-
};
|
|
952
|
-
const envOptions = {
|
|
953
|
-
prefix: "NITRO_",
|
|
954
|
-
altPrefix: _inlineRuntimeConfig.nitro.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
|
|
955
|
-
envExpansion: _inlineRuntimeConfig.nitro.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false
|
|
956
|
-
};
|
|
957
|
-
const _sharedRuntimeConfig = _deepFreeze(
|
|
958
|
-
applyEnv(klona(_inlineRuntimeConfig), envOptions)
|
|
959
|
-
);
|
|
960
|
-
function useRuntimeConfig(event) {
|
|
961
|
-
if (!event) {
|
|
962
|
-
return _sharedRuntimeConfig;
|
|
963
|
-
}
|
|
964
|
-
if (event.context.nitro.runtimeConfig) {
|
|
965
|
-
return event.context.nitro.runtimeConfig;
|
|
966
|
-
}
|
|
967
|
-
const runtimeConfig = klona(_inlineRuntimeConfig);
|
|
968
|
-
applyEnv(runtimeConfig, envOptions);
|
|
969
|
-
event.context.nitro.runtimeConfig = runtimeConfig;
|
|
970
|
-
return runtimeConfig;
|
|
971
|
-
}
|
|
972
|
-
_deepFreeze(klona(appConfig));
|
|
973
|
-
function _deepFreeze(object) {
|
|
974
|
-
const propNames = Object.getOwnPropertyNames(object);
|
|
975
|
-
for (const name of propNames) {
|
|
976
|
-
const value = object[name];
|
|
977
|
-
if (value && typeof value === "object") {
|
|
978
|
-
_deepFreeze(value);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
return Object.freeze(object);
|
|
982
|
-
}
|
|
983
|
-
new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
984
|
-
get: (_, prop) => {
|
|
985
|
-
console.warn(
|
|
986
|
-
"Please use `useRuntimeConfig()` instead of accessing config directly."
|
|
987
|
-
);
|
|
988
|
-
const runtimeConfig = useRuntimeConfig();
|
|
989
|
-
if (prop in runtimeConfig) {
|
|
990
|
-
return runtimeConfig[prop];
|
|
991
|
-
}
|
|
992
|
-
return void 0;
|
|
993
|
-
}
|
|
994
|
-
});
|
|
995
|
-
|
|
996
|
-
getContext("nitro-app", {
|
|
997
|
-
asyncContext: false,
|
|
998
|
-
AsyncLocalStorage: void 0
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
const config = useRuntimeConfig();
|
|
1002
|
-
const _routeRulesMatcher = toRouteMatcher(
|
|
1003
|
-
createRouter({ routes: config.nitro.routeRules })
|
|
1004
|
-
);
|
|
1005
|
-
function createRouteRulesHandler(ctx) {
|
|
1006
|
-
return eventHandler((event) => {
|
|
1007
|
-
const routeRules = getRouteRules(event);
|
|
1008
|
-
if (routeRules.headers) {
|
|
1009
|
-
setHeaders(event, routeRules.headers);
|
|
1010
|
-
}
|
|
1011
|
-
if (routeRules.redirect) {
|
|
1012
|
-
let target = routeRules.redirect.to;
|
|
1013
|
-
if (target.endsWith("/**")) {
|
|
1014
|
-
let targetPath = event.path;
|
|
1015
|
-
const strpBase = routeRules.redirect._redirectStripBase;
|
|
1016
|
-
if (strpBase) {
|
|
1017
|
-
targetPath = withoutBase(targetPath, strpBase);
|
|
1018
|
-
}
|
|
1019
|
-
target = joinURL(target.slice(0, -3), targetPath);
|
|
1020
|
-
} else if (event.path.includes("?")) {
|
|
1021
|
-
const query = getQuery(event.path);
|
|
1022
|
-
target = withQuery(target, query);
|
|
1023
|
-
}
|
|
1024
|
-
return sendRedirect(event, target, routeRules.redirect.statusCode);
|
|
1025
|
-
}
|
|
1026
|
-
if (routeRules.proxy) {
|
|
1027
|
-
let target = routeRules.proxy.to;
|
|
1028
|
-
if (target.endsWith("/**")) {
|
|
1029
|
-
let targetPath = event.path;
|
|
1030
|
-
const strpBase = routeRules.proxy._proxyStripBase;
|
|
1031
|
-
if (strpBase) {
|
|
1032
|
-
targetPath = withoutBase(targetPath, strpBase);
|
|
1033
|
-
}
|
|
1034
|
-
target = joinURL(target.slice(0, -3), targetPath);
|
|
1035
|
-
} else if (event.path.includes("?")) {
|
|
1036
|
-
const query = getQuery(event.path);
|
|
1037
|
-
target = withQuery(target, query);
|
|
1038
|
-
}
|
|
1039
|
-
return proxyRequest(event, target, {
|
|
1040
|
-
fetch: ctx.localFetch,
|
|
1041
|
-
...routeRules.proxy
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1046
|
-
function getRouteRules(event) {
|
|
1047
|
-
event.context._nitro = event.context._nitro || {};
|
|
1048
|
-
if (!event.context._nitro.routeRules) {
|
|
1049
|
-
event.context._nitro.routeRules = getRouteRulesForPath(
|
|
1050
|
-
withoutBase(event.path.split("?")[0], useRuntimeConfig().app.baseURL)
|
|
1051
|
-
);
|
|
1052
|
-
}
|
|
1053
|
-
return event.context._nitro.routeRules;
|
|
1054
|
-
}
|
|
1055
|
-
function getRouteRulesForPath(path) {
|
|
1056
|
-
return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
function _captureError(error, type) {
|
|
1060
|
-
console.error(`[${type}]`, error);
|
|
1061
|
-
useNitroApp().captureError(error, { tags: [type] });
|
|
1062
|
-
}
|
|
1063
|
-
function trapUnhandledNodeErrors() {
|
|
1064
|
-
process.on(
|
|
1065
|
-
"unhandledRejection",
|
|
1066
|
-
(error) => _captureError(error, "unhandledRejection")
|
|
1067
|
-
);
|
|
1068
|
-
process.on(
|
|
1069
|
-
"uncaughtException",
|
|
1070
|
-
(error) => _captureError(error, "uncaughtException")
|
|
1071
|
-
);
|
|
1072
|
-
}
|
|
1073
|
-
function joinHeaders(value) {
|
|
1074
|
-
return Array.isArray(value) ? value.join(", ") : String(value);
|
|
1075
|
-
}
|
|
1076
|
-
function normalizeFetchResponse(response) {
|
|
1077
|
-
if (!response.headers.has("set-cookie")) {
|
|
1078
|
-
return response;
|
|
1079
|
-
}
|
|
1080
|
-
return new Response(response.body, {
|
|
1081
|
-
status: response.status,
|
|
1082
|
-
statusText: response.statusText,
|
|
1083
|
-
headers: normalizeCookieHeaders(response.headers)
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
function normalizeCookieHeader(header = "") {
|
|
1087
|
-
return splitCookiesString(joinHeaders(header));
|
|
1088
|
-
}
|
|
1089
|
-
function normalizeCookieHeaders(headers) {
|
|
1090
|
-
const outgoingHeaders = new Headers();
|
|
1091
|
-
for (const [name, header] of headers) {
|
|
1092
|
-
if (name === "set-cookie") {
|
|
1093
|
-
for (const cookie of normalizeCookieHeader(header)) {
|
|
1094
|
-
outgoingHeaders.append("set-cookie", cookie);
|
|
1095
|
-
}
|
|
1096
|
-
} else {
|
|
1097
|
-
outgoingHeaders.set(name, joinHeaders(header));
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
return outgoingHeaders;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
function isJsonRequest(event) {
|
|
1104
|
-
if (hasReqHeader(event, "accept", "text/html")) {
|
|
1105
|
-
return false;
|
|
1106
|
-
}
|
|
1107
|
-
return hasReqHeader(event, "accept", "application/json") || hasReqHeader(event, "user-agent", "curl/") || hasReqHeader(event, "user-agent", "httpie/") || hasReqHeader(event, "sec-fetch-mode", "cors") || event.path.startsWith("/api/") || event.path.endsWith(".json");
|
|
1108
|
-
}
|
|
1109
|
-
function hasReqHeader(event, name, includes) {
|
|
1110
|
-
const value = getRequestHeader(event, name);
|
|
1111
|
-
return value && typeof value === "string" && value.toLowerCase().includes(includes);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
const errorHandler$0 = (async function errorhandler(error, event, { defaultHandler }) {
|
|
1115
|
-
if (event.handled || isJsonRequest(event)) {
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
const defaultRes = await defaultHandler(error, event, { json: true });
|
|
1119
|
-
const statusCode = error.statusCode || 500;
|
|
1120
|
-
if (statusCode === 404 && defaultRes.status === 302) {
|
|
1121
|
-
setResponseHeaders(event, defaultRes.headers);
|
|
1122
|
-
setResponseStatus(event, defaultRes.status, defaultRes.statusText);
|
|
1123
|
-
return send(event, JSON.stringify(defaultRes.body, null, 2));
|
|
1124
|
-
}
|
|
1125
|
-
if (typeof defaultRes.body !== "string" && Array.isArray(defaultRes.body.stack)) {
|
|
1126
|
-
defaultRes.body.stack = defaultRes.body.stack.join("\n");
|
|
1127
|
-
}
|
|
1128
|
-
const errorObject = defaultRes.body;
|
|
1129
|
-
const url = new URL(errorObject.url);
|
|
1130
|
-
errorObject.url = withoutBase(url.pathname, useRuntimeConfig(event).app.baseURL) + url.search + url.hash;
|
|
1131
|
-
errorObject.message ||= "Server Error";
|
|
1132
|
-
errorObject.data ||= error.data;
|
|
1133
|
-
errorObject.statusMessage ||= error.statusMessage;
|
|
1134
|
-
delete defaultRes.headers["content-type"];
|
|
1135
|
-
delete defaultRes.headers["content-security-policy"];
|
|
1136
|
-
setResponseHeaders(event, defaultRes.headers);
|
|
1137
|
-
const reqHeaders = getRequestHeaders(event);
|
|
1138
|
-
const isRenderingError = event.path.startsWith("/__nuxt_error") || !!reqHeaders["x-nuxt-error"];
|
|
1139
|
-
const res = isRenderingError ? null : await useNitroApp().localFetch(
|
|
1140
|
-
withQuery(joinURL(useRuntimeConfig(event).app.baseURL, "/__nuxt_error"), errorObject),
|
|
1141
|
-
{
|
|
1142
|
-
headers: { ...reqHeaders, "x-nuxt-error": "true" },
|
|
1143
|
-
redirect: "manual"
|
|
1144
|
-
}
|
|
1145
|
-
).catch(() => null);
|
|
1146
|
-
if (event.handled) {
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
if (!res) {
|
|
1150
|
-
const { template } = await Promise.resolve().then(function () { return errorDev; }) ;
|
|
1151
|
-
{
|
|
1152
|
-
errorObject.description = errorObject.message;
|
|
1153
|
-
}
|
|
1154
|
-
setResponseHeader(event, "Content-Type", "text/html;charset=UTF-8");
|
|
1155
|
-
return send(event, template(errorObject));
|
|
1156
|
-
}
|
|
1157
|
-
const html = await res.text();
|
|
1158
|
-
for (const [header, value] of res.headers.entries()) {
|
|
1159
|
-
if (header === "set-cookie") {
|
|
1160
|
-
appendResponseHeader(event, header, value);
|
|
1161
|
-
continue;
|
|
1162
|
-
}
|
|
1163
|
-
setResponseHeader(event, header, value);
|
|
1164
|
-
}
|
|
1165
|
-
setResponseStatus(event, res.status && res.status !== 200 ? res.status : defaultRes.status, res.statusText || defaultRes.statusText);
|
|
1166
|
-
return send(event, html);
|
|
1167
|
-
});
|
|
1168
|
-
|
|
1169
|
-
function defineNitroErrorHandler(handler) {
|
|
1170
|
-
return handler;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
const errorHandler$1 = defineNitroErrorHandler(
|
|
1174
|
-
async function defaultNitroErrorHandler(error, event) {
|
|
1175
|
-
const res = await defaultHandler(error, event);
|
|
1176
|
-
if (!event.node?.res.headersSent) {
|
|
1177
|
-
setResponseHeaders(event, res.headers);
|
|
1178
|
-
}
|
|
1179
|
-
setResponseStatus(event, res.status, res.statusText);
|
|
1180
|
-
return send(
|
|
1181
|
-
event,
|
|
1182
|
-
typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2)
|
|
1183
|
-
);
|
|
1184
|
-
}
|
|
1185
|
-
);
|
|
1186
|
-
async function defaultHandler(error, event, opts) {
|
|
1187
|
-
const isSensitive = error.unhandled || error.fatal;
|
|
1188
|
-
const statusCode = error.statusCode || 500;
|
|
1189
|
-
const statusMessage = error.statusMessage || "Server Error";
|
|
1190
|
-
const url = getRequestURL(event, { xForwardedHost: true, xForwardedProto: true });
|
|
1191
|
-
if (statusCode === 404) {
|
|
1192
|
-
const baseURL = "/";
|
|
1193
|
-
if (/^\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {
|
|
1194
|
-
const redirectTo = `${baseURL}${url.pathname.slice(1)}${url.search}`;
|
|
1195
|
-
return {
|
|
1196
|
-
status: 302,
|
|
1197
|
-
statusText: "Found",
|
|
1198
|
-
headers: { location: redirectTo },
|
|
1199
|
-
body: `Redirecting...`
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
await loadStackTrace(error).catch(consola.error);
|
|
1204
|
-
const youch = new Youch();
|
|
1205
|
-
if (isSensitive && !opts?.silent) {
|
|
1206
|
-
const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
|
|
1207
|
-
const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), ".");
|
|
1208
|
-
consola.error(
|
|
1209
|
-
`[request error] ${tags} [${event.method}] ${url}
|
|
1210
|
-
|
|
1211
|
-
`,
|
|
1212
|
-
ansiError
|
|
1213
|
-
);
|
|
1214
|
-
}
|
|
1215
|
-
const useJSON = opts?.json || !getRequestHeader(event, "accept")?.includes("text/html");
|
|
1216
|
-
const headers = {
|
|
1217
|
-
"content-type": useJSON ? "application/json" : "text/html",
|
|
1218
|
-
// Prevent browser from guessing the MIME types of resources.
|
|
1219
|
-
"x-content-type-options": "nosniff",
|
|
1220
|
-
// Prevent error page from being embedded in an iframe
|
|
1221
|
-
"x-frame-options": "DENY",
|
|
1222
|
-
// Prevent browsers from sending the Referer header
|
|
1223
|
-
"referrer-policy": "no-referrer",
|
|
1224
|
-
// Disable the execution of any js
|
|
1225
|
-
"content-security-policy": "script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';"
|
|
1226
|
-
};
|
|
1227
|
-
if (statusCode === 404 || !getResponseHeader(event, "cache-control")) {
|
|
1228
|
-
headers["cache-control"] = "no-cache";
|
|
1229
|
-
}
|
|
1230
|
-
const body = useJSON ? {
|
|
1231
|
-
error: true,
|
|
1232
|
-
url,
|
|
1233
|
-
statusCode,
|
|
1234
|
-
statusMessage,
|
|
1235
|
-
message: error.message,
|
|
1236
|
-
data: error.data,
|
|
1237
|
-
stack: error.stack?.split("\n").map((line) => line.trim())
|
|
1238
|
-
} : await youch.toHTML(error, {
|
|
1239
|
-
request: {
|
|
1240
|
-
url: url.href,
|
|
1241
|
-
method: event.method,
|
|
1242
|
-
headers: getRequestHeaders(event)
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
return {
|
|
1246
|
-
status: statusCode,
|
|
1247
|
-
statusText: statusMessage,
|
|
1248
|
-
headers,
|
|
1249
|
-
body
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
async function loadStackTrace(error) {
|
|
1253
|
-
if (!(error instanceof Error)) {
|
|
1254
|
-
return;
|
|
1255
|
-
}
|
|
1256
|
-
const parsed = await new ErrorParser().defineSourceLoader(sourceLoader).parse(error);
|
|
1257
|
-
const stack = error.message + "\n" + parsed.frames.map((frame) => fmtFrame(frame)).join("\n");
|
|
1258
|
-
Object.defineProperty(error, "stack", { value: stack });
|
|
1259
|
-
if (error.cause) {
|
|
1260
|
-
await loadStackTrace(error.cause).catch(consola.error);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
async function sourceLoader(frame) {
|
|
1264
|
-
if (!frame.fileName || frame.fileType !== "fs" || frame.type === "native") {
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
if (frame.type === "app") {
|
|
1268
|
-
const rawSourceMap = await readFile(`${frame.fileName}.map`, "utf8").catch(() => {
|
|
1269
|
-
});
|
|
1270
|
-
if (rawSourceMap) {
|
|
1271
|
-
const consumer = await new SourceMapConsumer(rawSourceMap);
|
|
1272
|
-
const originalPosition = consumer.originalPositionFor({ line: frame.lineNumber, column: frame.columnNumber });
|
|
1273
|
-
if (originalPosition.source && originalPosition.line) {
|
|
1274
|
-
frame.fileName = resolve(dirname(frame.fileName), originalPosition.source);
|
|
1275
|
-
frame.lineNumber = originalPosition.line;
|
|
1276
|
-
frame.columnNumber = originalPosition.column || 0;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
const contents = await readFile(frame.fileName, "utf8").catch(() => {
|
|
1281
|
-
});
|
|
1282
|
-
return contents ? { contents } : void 0;
|
|
1283
|
-
}
|
|
1284
|
-
function fmtFrame(frame) {
|
|
1285
|
-
if (frame.type === "native") {
|
|
1286
|
-
return frame.raw;
|
|
1287
|
-
}
|
|
1288
|
-
const src = `${frame.fileName || ""}:${frame.lineNumber}:${frame.columnNumber})`;
|
|
1289
|
-
return frame.functionName ? `at ${frame.functionName} (${src}` : `at ${src}`;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
const errorHandlers = [errorHandler$0, errorHandler$1];
|
|
1293
|
-
|
|
1294
|
-
async function errorHandler(error, event) {
|
|
1295
|
-
for (const handler of errorHandlers) {
|
|
1296
|
-
try {
|
|
1297
|
-
await handler(error, event, { defaultHandler });
|
|
1298
|
-
if (event.handled) {
|
|
1299
|
-
return; // Response handled
|
|
1300
|
-
}
|
|
1301
|
-
} catch(error) {
|
|
1302
|
-
// Handler itself thrown, log and continue
|
|
1303
|
-
console.error(error);
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
// H3 will handle fallback
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
const script = `
|
|
1310
|
-
if (!window.__NUXT_DEVTOOLS_TIME_METRIC__) {
|
|
1311
|
-
Object.defineProperty(window, '__NUXT_DEVTOOLS_TIME_METRIC__', {
|
|
1312
|
-
value: {},
|
|
1313
|
-
enumerable: false,
|
|
1314
|
-
configurable: true,
|
|
1315
|
-
})
|
|
1316
|
-
}
|
|
1317
|
-
window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
|
|
1318
|
-
`;
|
|
1319
|
-
|
|
1320
|
-
const _hZqqNT8tE8lxe7ouBdv0a2rKDw4eAU928mBe8tbPasE = (function(nitro) {
|
|
1321
|
-
nitro.hooks.hook("render:html", (htmlContext) => {
|
|
1322
|
-
htmlContext.head.push(`<script>${script}<\/script>`);
|
|
1323
|
-
});
|
|
1324
|
-
});
|
|
1325
|
-
|
|
1326
|
-
const rootDir = "/home/devin/projects/Cryobank/nuxt-layers/layers/base";
|
|
1327
|
-
|
|
1328
|
-
const appHead = {"meta":[{"name":"viewport","content":"width=device-width, initial-scale=1"},{"charset":"utf-8"}],"link":[],"style":[],"script":[],"noscript":[]};
|
|
1329
|
-
|
|
1330
|
-
const appRootTag = "div";
|
|
1331
|
-
|
|
1332
|
-
const appRootAttrs = {"id":"__nuxt"};
|
|
1333
|
-
|
|
1334
|
-
const appTeleportTag = "div";
|
|
1335
|
-
|
|
1336
|
-
const appTeleportAttrs = {"id":"teleports"};
|
|
1337
|
-
|
|
1338
|
-
const appSpaLoaderTag = "div";
|
|
1339
|
-
|
|
1340
|
-
const appSpaLoaderAttrs = {"id":"__nuxt-loader"};
|
|
1341
|
-
|
|
1342
|
-
const appId = "nuxt-app";
|
|
1343
|
-
|
|
1344
|
-
const devReducers = {
|
|
1345
|
-
VNode: (data) => isVNode(data) ? { type: data.type, props: data.props } : void 0,
|
|
1346
|
-
URL: (data) => data instanceof URL ? data.toString() : void 0
|
|
1347
|
-
};
|
|
1348
|
-
const asyncContext = getContext("nuxt-dev", { asyncContext: true, AsyncLocalStorage });
|
|
1349
|
-
const _nSkC1tXxFYa6LbR7LPXnxyyd2QHs1BF1IDNNB820PUo = (nitroApp) => {
|
|
1350
|
-
const handler = nitroApp.h3App.handler;
|
|
1351
|
-
nitroApp.h3App.handler = (event) => {
|
|
1352
|
-
return asyncContext.callAsync({ logs: [], event }, () => handler(event));
|
|
1353
|
-
};
|
|
1354
|
-
onConsoleLog((_log) => {
|
|
1355
|
-
const ctx = asyncContext.tryUse();
|
|
1356
|
-
if (!ctx) {
|
|
1357
|
-
return;
|
|
1358
|
-
}
|
|
1359
|
-
const rawStack = captureRawStackTrace();
|
|
1360
|
-
if (!rawStack || rawStack.includes("runtime/vite-node.mjs")) {
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
|
-
const trace = [];
|
|
1364
|
-
let filename = "";
|
|
1365
|
-
for (const entry of parseRawStackTrace(rawStack)) {
|
|
1366
|
-
if (entry.source === globalThis._importMeta_.url) {
|
|
1367
|
-
continue;
|
|
1368
|
-
}
|
|
1369
|
-
if (EXCLUDE_TRACE_RE.test(entry.source)) {
|
|
1370
|
-
continue;
|
|
1371
|
-
}
|
|
1372
|
-
filename ||= entry.source.replace(withTrailingSlash(rootDir), "");
|
|
1373
|
-
trace.push({
|
|
1374
|
-
...entry,
|
|
1375
|
-
source: entry.source.startsWith("file://") ? entry.source.replace("file://", "") : entry.source
|
|
1376
|
-
});
|
|
1377
|
-
}
|
|
1378
|
-
const log = {
|
|
1379
|
-
..._log,
|
|
1380
|
-
// Pass along filename to allow the client to display more info about where log comes from
|
|
1381
|
-
filename,
|
|
1382
|
-
// Clean up file names in stack trace
|
|
1383
|
-
stack: trace
|
|
1384
|
-
};
|
|
1385
|
-
ctx.logs.push(log);
|
|
1386
|
-
});
|
|
1387
|
-
nitroApp.hooks.hook("afterResponse", () => {
|
|
1388
|
-
const ctx = asyncContext.tryUse();
|
|
1389
|
-
if (!ctx) {
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
return nitroApp.hooks.callHook("dev:ssr-logs", { logs: ctx.logs, path: ctx.event.path });
|
|
1393
|
-
});
|
|
1394
|
-
nitroApp.hooks.hook("render:html", (htmlContext) => {
|
|
1395
|
-
const ctx = asyncContext.tryUse();
|
|
1396
|
-
if (!ctx) {
|
|
1397
|
-
return;
|
|
1398
|
-
}
|
|
1399
|
-
try {
|
|
1400
|
-
const reducers = Object.assign(/* @__PURE__ */ Object.create(null), devReducers, ctx.event.context._payloadReducers);
|
|
1401
|
-
htmlContext.bodyAppend.unshift(`<script type="application/json" data-nuxt-logs="${appId}">${stringify(ctx.logs, reducers)}<\/script>`);
|
|
1402
|
-
} catch (e) {
|
|
1403
|
-
const shortError = e instanceof Error && "toString" in e ? ` Received \`${e.toString()}\`.` : "";
|
|
1404
|
-
console.warn(`[nuxt] Failed to stringify dev server logs.${shortError} You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/api/composables/use-nuxt-app#payload.`);
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
};
|
|
1408
|
-
const EXCLUDE_TRACE_RE = /\/node_modules\/(?:.*\/)?(?:nuxt|nuxt-nightly|nuxt-edge|nuxt3|consola|@vue)\/|core\/runtime\/nitro/;
|
|
1409
|
-
function onConsoleLog(callback) {
|
|
1410
|
-
consola$1.addReporter({
|
|
1411
|
-
log(logObj) {
|
|
1412
|
-
callback(logObj);
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
consola$1.wrapConsole();
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
function useI18nContext(event) {
|
|
1419
|
-
if (event.context.nuxtI18n == null) {
|
|
1420
|
-
throw new Error("Nuxt I18n server context has not been set up yet.");
|
|
1421
|
-
}
|
|
1422
|
-
return event.context.nuxtI18n;
|
|
1423
|
-
}
|
|
1424
|
-
function tryUseI18nContext(event) {
|
|
1425
|
-
return event.context.nuxtI18n;
|
|
1426
|
-
}
|
|
1427
|
-
const headers = new Headers({ "x-nuxt-i18n": "internal" });
|
|
1428
|
-
{
|
|
1429
|
-
headers.set("Cache-Control", "no-cache");
|
|
1430
|
-
}
|
|
1431
|
-
function createI18nContext() {
|
|
1432
|
-
return {
|
|
1433
|
-
messages: {},
|
|
1434
|
-
slp: {},
|
|
1435
|
-
localeConfigs: {},
|
|
1436
|
-
trackMap: {},
|
|
1437
|
-
vueI18nOptions: void 0,
|
|
1438
|
-
trackKey(key, locale) {
|
|
1439
|
-
this.trackMap[locale] ??= /* @__PURE__ */ new Set();
|
|
1440
|
-
this.trackMap[locale].add(key);
|
|
1441
|
-
}
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
/*!
|
|
1446
|
-
* shared v11.1.11
|
|
1447
|
-
* (c) 2025 kazuya kawaguchi
|
|
1448
|
-
* Released under the MIT License.
|
|
1449
|
-
*/
|
|
1450
|
-
const _create = Object.create;
|
|
1451
|
-
const create = (obj = null) => _create(obj);
|
|
1452
|
-
/* eslint-enable */
|
|
1453
|
-
/**
|
|
1454
|
-
* Useful Utilities By Evan you
|
|
1455
|
-
* Modified by kazuya kawaguchi
|
|
1456
|
-
* MIT License
|
|
1457
|
-
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/index.ts
|
|
1458
|
-
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/codeframe.ts
|
|
1459
|
-
*/
|
|
1460
|
-
const isArray = Array.isArray;
|
|
1461
|
-
const isFunction = (val) => typeof val === 'function';
|
|
1462
|
-
const isString = (val) => typeof val === 'string';
|
|
1463
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1464
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
1465
|
-
const objectToString = Object.prototype.toString;
|
|
1466
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
1467
|
-
|
|
1468
|
-
const isNotObjectOrIsArray = (val) => !isObject(val) || isArray(val);
|
|
1469
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1470
|
-
function deepCopy(src, des) {
|
|
1471
|
-
// src and des should both be objects, and none of them can be a array
|
|
1472
|
-
if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) {
|
|
1473
|
-
throw new Error('Invalid value');
|
|
1474
|
-
}
|
|
1475
|
-
const stack = [{ src, des }];
|
|
1476
|
-
while (stack.length) {
|
|
1477
|
-
const { src, des } = stack.pop();
|
|
1478
|
-
// using `Object.keys` which skips prototype properties
|
|
1479
|
-
Object.keys(src).forEach(key => {
|
|
1480
|
-
if (key === '__proto__') {
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
|
-
// if src[key] is an object/array, set des[key]
|
|
1484
|
-
// to empty object/array to prevent setting by reference
|
|
1485
|
-
if (isObject(src[key]) && !isObject(des[key])) {
|
|
1486
|
-
des[key] = Array.isArray(src[key]) ? [] : create();
|
|
1487
|
-
}
|
|
1488
|
-
if (isNotObjectOrIsArray(des[key]) || isNotObjectOrIsArray(src[key])) {
|
|
1489
|
-
// replace with src[key] when:
|
|
1490
|
-
// src[key] or des[key] is not an object, or
|
|
1491
|
-
// src[key] or des[key] is an array
|
|
1492
|
-
des[key] = src[key];
|
|
1493
|
-
}
|
|
1494
|
-
else {
|
|
1495
|
-
// src[key] and des[key] are both objects, merge them
|
|
1496
|
-
stack.push({ src: src[key], des: des[key] });
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
function matchBrowserLocale(locales, browserLocales) {
|
|
1503
|
-
const matchedLocales = [];
|
|
1504
|
-
for (const [index, browserCode] of browserLocales.entries()) {
|
|
1505
|
-
const matchedLocale = locales.find((l) => l.language?.toLowerCase() === browserCode.toLowerCase());
|
|
1506
|
-
if (matchedLocale) {
|
|
1507
|
-
matchedLocales.push({ code: matchedLocale.code, score: 1 - index / browserLocales.length });
|
|
1508
|
-
break;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
for (const [index, browserCode] of browserLocales.entries()) {
|
|
1512
|
-
const languageCode = browserCode.split("-")[0].toLowerCase();
|
|
1513
|
-
const matchedLocale = locales.find((l) => l.language?.split("-")[0].toLowerCase() === languageCode);
|
|
1514
|
-
if (matchedLocale) {
|
|
1515
|
-
matchedLocales.push({ code: matchedLocale.code, score: 0.999 - index / browserLocales.length });
|
|
1516
|
-
break;
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
return matchedLocales;
|
|
1520
|
-
}
|
|
1521
|
-
function compareBrowserLocale(a, b) {
|
|
1522
|
-
if (a.score === b.score) {
|
|
1523
|
-
return b.code.length - a.code.length;
|
|
1524
|
-
}
|
|
1525
|
-
return b.score - a.score;
|
|
1526
|
-
}
|
|
1527
|
-
function findBrowserLocale(locales, browserLocales) {
|
|
1528
|
-
const matchedLocales = matchBrowserLocale(
|
|
1529
|
-
locales.map((l) => ({ code: l.code, language: l.language || l.code })),
|
|
1530
|
-
browserLocales
|
|
1531
|
-
);
|
|
1532
|
-
return matchedLocales.sort(compareBrowserLocale).at(0)?.code ?? "";
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
// @ts-nocheck
|
|
1536
|
-
const localeCodes = [
|
|
1537
|
-
"enUS"
|
|
1538
|
-
];
|
|
1539
|
-
const localeLoaders = {
|
|
1540
|
-
enUS: []
|
|
1541
|
-
};
|
|
1542
|
-
const vueI18nConfigs = [];
|
|
1543
|
-
const normalizedLocales = [
|
|
1544
|
-
{
|
|
1545
|
-
code: "enUS",
|
|
1546
|
-
language: "en-US"
|
|
1547
|
-
}
|
|
1548
|
-
];
|
|
1549
|
-
|
|
1550
|
-
function createLocaleConfigs(fallbackLocale) {
|
|
1551
|
-
const localeConfigs = {};
|
|
1552
|
-
for (const locale of localeCodes) {
|
|
1553
|
-
const fallbacks = getFallbackLocaleCodes(fallbackLocale, [locale]);
|
|
1554
|
-
const cacheable = isLocaleWithFallbacksCacheable(locale, fallbacks);
|
|
1555
|
-
localeConfigs[locale] = { fallbacks, cacheable };
|
|
1556
|
-
}
|
|
1557
|
-
return localeConfigs;
|
|
1558
|
-
}
|
|
1559
|
-
function getFallbackLocaleCodes(fallback, locales) {
|
|
1560
|
-
if (fallback === false) return [];
|
|
1561
|
-
if (isArray(fallback)) return fallback;
|
|
1562
|
-
let fallbackLocales = [];
|
|
1563
|
-
if (isString(fallback)) {
|
|
1564
|
-
if (locales.every((locale) => locale !== fallback)) {
|
|
1565
|
-
fallbackLocales.push(fallback);
|
|
1566
|
-
}
|
|
1567
|
-
return fallbackLocales;
|
|
1568
|
-
}
|
|
1569
|
-
const targets = [...locales, "default"];
|
|
1570
|
-
for (const locale of targets) {
|
|
1571
|
-
if (locale in fallback == false) continue;
|
|
1572
|
-
fallbackLocales = [...fallbackLocales, ...fallback[locale].filter(Boolean)];
|
|
1573
|
-
}
|
|
1574
|
-
return fallbackLocales;
|
|
1575
|
-
}
|
|
1576
|
-
function isLocaleCacheable(locale) {
|
|
1577
|
-
return localeLoaders[locale] != null && localeLoaders[locale].every((loader) => loader.cache !== false);
|
|
1578
|
-
}
|
|
1579
|
-
function isLocaleWithFallbacksCacheable(locale, fallbackLocales) {
|
|
1580
|
-
return isLocaleCacheable(locale) && fallbackLocales.every((fallbackLocale) => isLocaleCacheable(fallbackLocale));
|
|
1581
|
-
}
|
|
1582
|
-
function getDefaultLocaleForDomain(host) {
|
|
1583
|
-
return normalizedLocales.find((l) => !!l.defaultForDomains?.includes(host))?.code;
|
|
1584
|
-
}
|
|
1585
|
-
const isSupportedLocale = (locale) => localeCodes.includes(locale || "");
|
|
1586
|
-
|
|
1587
|
-
const __nuxtMock = { runWithContext: async (fn) => await fn() };
|
|
1588
|
-
async function loadVueI18nOptions(vueI18nConfigs) {
|
|
1589
|
-
const nuxtApp = __nuxtMock;
|
|
1590
|
-
const vueI18nOptions = { messages: {} };
|
|
1591
|
-
for (const configFile of vueI18nConfigs) {
|
|
1592
|
-
const resolver = await configFile().then((x) => x.default);
|
|
1593
|
-
const resolved = isFunction(resolver) ? await nuxtApp.runWithContext(() => resolver()) : resolver;
|
|
1594
|
-
deepCopy(resolved, vueI18nOptions);
|
|
1595
|
-
}
|
|
1596
|
-
vueI18nOptions.fallbackLocale ??= false;
|
|
1597
|
-
return vueI18nOptions;
|
|
1598
|
-
}
|
|
1599
|
-
const isModule = (val) => toTypeString(val) === "[object Module]";
|
|
1600
|
-
const isResolvedModule = (val) => isModule(val) || true;
|
|
1601
|
-
async function getLocaleMessages(locale, loader) {
|
|
1602
|
-
const nuxtApp = __nuxtMock;
|
|
1603
|
-
try {
|
|
1604
|
-
const getter = await nuxtApp.runWithContext(loader.load).then((x) => isResolvedModule(x) ? x.default : x);
|
|
1605
|
-
return isFunction(getter) ? await nuxtApp.runWithContext(() => getter(locale)) : getter;
|
|
1606
|
-
} catch (e) {
|
|
1607
|
-
throw new Error(`Failed loading locale (${locale}): ` + e.message);
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
async function getLocaleMessagesMerged(locale, loaders = []) {
|
|
1611
|
-
const nuxtApp = __nuxtMock;
|
|
1612
|
-
const merged = {};
|
|
1613
|
-
for (const loader of loaders) {
|
|
1614
|
-
deepCopy(await nuxtApp.runWithContext(async () => await getLocaleMessages(locale, loader)), merged);
|
|
1615
|
-
}
|
|
1616
|
-
return merged;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
const setupVueI18nOptions = async (defaultLocale) => {
|
|
1620
|
-
const options = await loadVueI18nOptions(vueI18nConfigs);
|
|
1621
|
-
options.locale = defaultLocale || options.locale || "en-US";
|
|
1622
|
-
options.defaultLocale = defaultLocale;
|
|
1623
|
-
options.fallbackLocale ??= false;
|
|
1624
|
-
options.messages ??= {};
|
|
1625
|
-
for (const locale of localeCodes) {
|
|
1626
|
-
options.messages[locale] ??= {};
|
|
1627
|
-
}
|
|
1628
|
-
return options;
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
|
-
function useRuntimeI18n(nuxtApp) {
|
|
1632
|
-
{
|
|
1633
|
-
return useRuntimeConfig().public.i18n;
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
function useI18nDetection(nuxtApp) {
|
|
1637
|
-
const detectBrowserLanguage = useRuntimeI18n().detectBrowserLanguage;
|
|
1638
|
-
const detect = detectBrowserLanguage || {};
|
|
1639
|
-
return {
|
|
1640
|
-
...detect,
|
|
1641
|
-
enabled: !!detectBrowserLanguage,
|
|
1642
|
-
cookieKey: detect.cookieKey || "i18n_redirected"
|
|
1643
|
-
};
|
|
1644
|
-
}
|
|
1645
|
-
function resolveRootRedirect(config) {
|
|
1646
|
-
if (!config) return void 0;
|
|
1647
|
-
return {
|
|
1648
|
-
path: "/" + (isString(config) ? config : config.path).replace(/^\//, ""),
|
|
1649
|
-
code: !isString(config) && config.statusCode || 302
|
|
1650
|
-
};
|
|
1651
|
-
}
|
|
1652
|
-
function toArray(value) {
|
|
1653
|
-
return Array.isArray(value) ? value : [value];
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
const separator = "___";
|
|
1657
|
-
const pathLanguageParser = createPathIndexLanguageParser(0);
|
|
1658
|
-
const getLocaleFromRoutePath = (path) => pathLanguageParser(path);
|
|
1659
|
-
const getLocaleFromRouteName = (name) => name.split(separator).at(1) ?? "";
|
|
1660
|
-
function normalizeInput(input) {
|
|
1661
|
-
return typeof input !== "object" ? String(input) : String(input?.name || input?.path || "");
|
|
1662
|
-
}
|
|
1663
|
-
function getLocaleFromRoute(route) {
|
|
1664
|
-
const input = normalizeInput(route);
|
|
1665
|
-
return input[0] === "/" ? getLocaleFromRoutePath(input) : getLocaleFromRouteName(input);
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
function matchDomainLocale(locales, host, pathLocale) {
|
|
1669
|
-
const normalizeDomain = (domain = "") => domain.replace(/https?:\/\//, "");
|
|
1670
|
-
const matches = locales.filter(
|
|
1671
|
-
(locale) => normalizeDomain(locale.domain) === host || toArray(locale.domains).includes(host)
|
|
1672
|
-
);
|
|
1673
|
-
if (matches.length <= 1) {
|
|
1674
|
-
return matches[0]?.code;
|
|
1675
|
-
}
|
|
1676
|
-
return (
|
|
1677
|
-
// match by current path locale
|
|
1678
|
-
matches.find((l) => l.code === pathLocale)?.code || // fallback to default locale for the domain
|
|
1679
|
-
matches.find((l) => l.defaultForDomains?.includes(host) ?? l.domainDefault)?.code
|
|
1680
|
-
);
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
const getCookieLocale = (event, cookieName) => {
|
|
1684
|
-
const cookieValue = getRequestHeader(event, "cookie") || "";
|
|
1685
|
-
return parse(cookieValue)[cookieName];
|
|
1686
|
-
};
|
|
1687
|
-
const getRouteLocale = (event, route) => getLocaleFromRoute(route);
|
|
1688
|
-
const getHeaderLocale = (event) => {
|
|
1689
|
-
return findBrowserLocale(normalizedLocales, parseAcceptLanguage(getRequestHeader(event, "accept-language") || ""));
|
|
1690
|
-
};
|
|
1691
|
-
const getHostLocale = (event, path, domainLocales) => {
|
|
1692
|
-
const host = getRequestURL(event, { xForwardedHost: true }).host;
|
|
1693
|
-
const locales = normalizedLocales.map((l) => ({
|
|
1694
|
-
...l,
|
|
1695
|
-
domain: domainLocales[l.code]?.domain ?? l.domain
|
|
1696
|
-
}));
|
|
1697
|
-
return matchDomainLocale(locales, host, getLocaleFromRoutePath(path));
|
|
1698
|
-
};
|
|
1699
|
-
const useDetectors = (event, config, nuxtApp) => {
|
|
1700
|
-
if (!event) {
|
|
1701
|
-
throw new Error("H3Event is required for server-side locale detection");
|
|
1702
|
-
}
|
|
1703
|
-
const runtimeI18n = useRuntimeI18n();
|
|
1704
|
-
return {
|
|
1705
|
-
cookie: () => getCookieLocale(event, config.cookieKey),
|
|
1706
|
-
header: () => getHeaderLocale(event) ,
|
|
1707
|
-
navigator: () => void 0,
|
|
1708
|
-
host: (path) => getHostLocale(event, path, runtimeI18n.domainLocales),
|
|
1709
|
-
route: (path) => getRouteLocale(event, path)
|
|
1710
|
-
};
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
|
-
// Generated by @nuxtjs/i18n
|
|
1714
|
-
const pathToI18nConfig = {};
|
|
1715
|
-
const i18nPathToPath = {};
|
|
1716
|
-
|
|
1717
|
-
const matcher = createRouterMatcher([], {});
|
|
1718
|
-
for (const path of Object.keys(i18nPathToPath)) {
|
|
1719
|
-
matcher.addRoute({ path, component: () => "", meta: {} });
|
|
1720
|
-
}
|
|
1721
|
-
const getI18nPathToI18nPath = (path, locale) => {
|
|
1722
|
-
if (!path || !locale) return;
|
|
1723
|
-
const plainPath = i18nPathToPath[path];
|
|
1724
|
-
const i18nConfig = pathToI18nConfig[plainPath];
|
|
1725
|
-
if (i18nConfig && i18nConfig[locale]) {
|
|
1726
|
-
return i18nConfig[locale] === true ? plainPath : i18nConfig[locale];
|
|
1727
|
-
}
|
|
1728
|
-
};
|
|
1729
|
-
function isExistingNuxtRoute(path) {
|
|
1730
|
-
if (path === "") return;
|
|
1731
|
-
const resolvedMatch = matcher.resolve({ path }, { path: "/", name: "", matched: [], params: {}, meta: {} });
|
|
1732
|
-
return resolvedMatch.matched.length > 0 ? resolvedMatch : void 0;
|
|
1733
|
-
}
|
|
1734
|
-
function matchLocalized(path, locale, defaultLocale) {
|
|
1735
|
-
if (path === "") return;
|
|
1736
|
-
const parsed = parsePath(path);
|
|
1737
|
-
const resolvedMatch = matcher.resolve(
|
|
1738
|
-
{ path: parsed.pathname || "/" },
|
|
1739
|
-
{ path: "/", name: "", matched: [], params: {}, meta: {} }
|
|
1740
|
-
);
|
|
1741
|
-
if (resolvedMatch.matched.length > 0) {
|
|
1742
|
-
const alternate = getI18nPathToI18nPath(resolvedMatch.matched[0].path, locale);
|
|
1743
|
-
const match = matcher.resolve(
|
|
1744
|
-
{ params: resolvedMatch.params },
|
|
1745
|
-
{ path: alternate || "/", name: "", matched: [], params: {}, meta: {} }
|
|
1746
|
-
);
|
|
1747
|
-
return withLeadingSlash(joinURL("", match.path));
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
const getHost = (event) => getRequestURL(event, { xForwardedHost: true }).host;
|
|
1752
|
-
function* detect(detectors, detection, path) {
|
|
1753
|
-
if (detection.enabled) {
|
|
1754
|
-
yield { locale: detectors.cookie(), source: "cookie" };
|
|
1755
|
-
yield { locale: detectors.header(), source: "header" };
|
|
1756
|
-
}
|
|
1757
|
-
yield { locale: detection.fallbackLocale, source: "fallback" };
|
|
1758
|
-
}
|
|
1759
|
-
const _0A0qCCBv71rPYdBZ4homFqNY8vKqYhFYcpFzVFErwRs = defineNitroPlugin(async (nitro) => {
|
|
1760
|
-
const runtimeI18n = useRuntimeI18n();
|
|
1761
|
-
const rootRedirect = resolveRootRedirect(runtimeI18n.rootRedirect);
|
|
1762
|
-
const _defaultLocale = runtimeI18n.defaultLocale || "";
|
|
1763
|
-
try {
|
|
1764
|
-
const cacheStorage = useStorage("cache");
|
|
1765
|
-
const cachedKeys = await cacheStorage.getKeys("nitro:handlers:i18n");
|
|
1766
|
-
await Promise.all(cachedKeys.map((key) => cacheStorage.removeItem(key)));
|
|
1767
|
-
} catch {
|
|
1768
|
-
}
|
|
1769
|
-
const detection = useI18nDetection();
|
|
1770
|
-
const cookieOptions = {
|
|
1771
|
-
path: "/",
|
|
1772
|
-
domain: detection.cookieDomain || void 0,
|
|
1773
|
-
maxAge: 60 * 60 * 24 * 365,
|
|
1774
|
-
sameSite: "lax",
|
|
1775
|
-
secure: detection.cookieSecure
|
|
1776
|
-
};
|
|
1777
|
-
const createBaseUrlGetter = () => {
|
|
1778
|
-
isFunction(runtimeI18n.baseUrl) ? "" : runtimeI18n.baseUrl || "";
|
|
1779
|
-
if (isFunction(runtimeI18n.baseUrl)) {
|
|
1780
|
-
console.warn("[nuxt-i18n] Configuring baseUrl as a function is deprecated and will be removed in v11.");
|
|
1781
|
-
return () => "";
|
|
1782
|
-
}
|
|
1783
|
-
return (event, defaultLocale) => {
|
|
1784
|
-
return "";
|
|
1785
|
-
};
|
|
1786
|
-
};
|
|
1787
|
-
function resolveRedirectPath(event, path, pathLocale, defaultLocale, detector) {
|
|
1788
|
-
let locale = "";
|
|
1789
|
-
for (const detected of detect(detector, detection, event.path)) {
|
|
1790
|
-
if (detected.locale && isSupportedLocale(detected.locale)) {
|
|
1791
|
-
locale = detected.locale;
|
|
1792
|
-
break;
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
locale ||= defaultLocale;
|
|
1796
|
-
function getLocalizedMatch(locale2) {
|
|
1797
|
-
const res = matchLocalized(path || "/", locale2);
|
|
1798
|
-
if (res && res !== event.path) {
|
|
1799
|
-
return res;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
let resolvedPath = void 0;
|
|
1803
|
-
let redirectCode = 302;
|
|
1804
|
-
const requestURL = getRequestURL(event);
|
|
1805
|
-
if (rootRedirect && requestURL.pathname === "/") {
|
|
1806
|
-
locale = detection.enabled && locale || defaultLocale;
|
|
1807
|
-
resolvedPath = isSupportedLocale(detector.route(rootRedirect.path)) && rootRedirect.path || matchLocalized(rootRedirect.path, locale);
|
|
1808
|
-
redirectCode = rootRedirect.code;
|
|
1809
|
-
} else if (runtimeI18n.redirectStatusCode) {
|
|
1810
|
-
redirectCode = runtimeI18n.redirectStatusCode;
|
|
1811
|
-
}
|
|
1812
|
-
switch (detection.redirectOn) {
|
|
1813
|
-
case "root":
|
|
1814
|
-
if (requestURL.pathname !== "/") break;
|
|
1815
|
-
// fallthrough (root has no prefix)
|
|
1816
|
-
case "no prefix":
|
|
1817
|
-
if (pathLocale) break;
|
|
1818
|
-
// fallthrough to resolve
|
|
1819
|
-
case "all":
|
|
1820
|
-
resolvedPath ??= getLocalizedMatch(locale);
|
|
1821
|
-
break;
|
|
1822
|
-
}
|
|
1823
|
-
if (requestURL.pathname === "/" && "prefix_except_default" === "prefix") ;
|
|
1824
|
-
return { path: resolvedPath, code: redirectCode, locale };
|
|
1825
|
-
}
|
|
1826
|
-
const baseUrlGetter = createBaseUrlGetter();
|
|
1827
|
-
nitro.hooks.hook("request", async (event) => {
|
|
1828
|
-
const options = await setupVueI18nOptions(getDefaultLocaleForDomain(getHost(event)) || _defaultLocale);
|
|
1829
|
-
const url = getRequestURL(event);
|
|
1830
|
-
const ctx = createI18nContext();
|
|
1831
|
-
event.context.nuxtI18n = ctx;
|
|
1832
|
-
{
|
|
1833
|
-
const detector = useDetectors(event, detection);
|
|
1834
|
-
const localeSegment = detector.route(event.path);
|
|
1835
|
-
const pathLocale = isSupportedLocale(localeSegment) && localeSegment || void 0;
|
|
1836
|
-
const path = pathLocale && url.pathname.slice(pathLocale.length + 1) || url.pathname;
|
|
1837
|
-
if (!url.pathname.includes("/_i18n/") && !isExistingNuxtRoute(path)) {
|
|
1838
|
-
return;
|
|
1839
|
-
}
|
|
1840
|
-
const resolved = resolveRedirectPath(event, path, pathLocale, options.defaultLocale, detector);
|
|
1841
|
-
if (resolved.path && resolved.path !== url.pathname) {
|
|
1842
|
-
ctx.detectLocale = resolved.locale;
|
|
1843
|
-
detection.useCookie && setCookie(event, detection.cookieKey, resolved.locale, cookieOptions);
|
|
1844
|
-
await sendRedirect(
|
|
1845
|
-
event,
|
|
1846
|
-
joinURL(baseUrlGetter(event, options.defaultLocale), resolved.path + url.search),
|
|
1847
|
-
resolved.code
|
|
1848
|
-
);
|
|
1849
|
-
return;
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
const localeConfigs = createLocaleConfigs(options.fallbackLocale);
|
|
1853
|
-
ctx.vueI18nOptions = options;
|
|
1854
|
-
ctx.localeConfigs = localeConfigs;
|
|
1855
|
-
});
|
|
1856
|
-
nitro.hooks.hook("render:html", (htmlContext, { event }) => {
|
|
1857
|
-
tryUseI18nContext(event);
|
|
1858
|
-
});
|
|
1859
|
-
});
|
|
1860
|
-
|
|
1861
|
-
function defineNitroPlugin(def) {
|
|
1862
|
-
return def;
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
const toErrorShape = (err) => {
|
|
1866
|
-
var _a;
|
|
1867
|
-
if (!err || typeof err !== "object") {
|
|
1868
|
-
return void 0;
|
|
1869
|
-
}
|
|
1870
|
-
const e = err;
|
|
1871
|
-
return {
|
|
1872
|
-
name: e.name || "Error",
|
|
1873
|
-
message: String((_a = e.message) != null ? _a : "Error"),
|
|
1874
|
-
stack: typeof e.stack === "string" ? e.stack.split("\n").slice(0, 20) : void 0
|
|
1875
|
-
};
|
|
1876
|
-
};
|
|
1877
|
-
const _howp3jkhGMh82JLRw256Um6MRymSMasjTQ4BkPR_ERQ = defineNitroPlugin((nitroApp) => {
|
|
1878
|
-
var _a;
|
|
1879
|
-
const config = useRuntimeConfig();
|
|
1880
|
-
if (!((_a = config.public) == null ? void 0 : _a.logglyEnabled) || !config.logglyToken) return;
|
|
1881
|
-
nitroApp.hooks.hook("error", async (error, ctx) => {
|
|
1882
|
-
var _a2, _b, _c, _d, _e;
|
|
1883
|
-
try {
|
|
1884
|
-
await $fetch("/api/loggly", {
|
|
1885
|
-
method: "POST",
|
|
1886
|
-
body: {
|
|
1887
|
-
level: "error",
|
|
1888
|
-
message: typeof error === "object" && error && "message" in error ? String(error.message) : "Server error",
|
|
1889
|
-
error: toErrorShape(error),
|
|
1890
|
-
meta: {
|
|
1891
|
-
url: (_a2 = ctx == null ? void 0 : ctx.event) == null ? void 0 : _a2.path,
|
|
1892
|
-
method: (_b = ctx == null ? void 0 : ctx.event) == null ? void 0 : _b.method,
|
|
1893
|
-
status: (_e = (_d = (_c = ctx == null ? void 0 : ctx.event) == null ? void 0 : _c.node) == null ? void 0 : _d.res) == null ? void 0 : _e.statusCode
|
|
1894
|
-
},
|
|
1895
|
-
tags: ["server"]
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1898
|
-
} catch {
|
|
1899
|
-
}
|
|
1900
|
-
});
|
|
1901
|
-
});
|
|
1902
|
-
|
|
1903
|
-
const plugins = [
|
|
1904
|
-
_hZqqNT8tE8lxe7ouBdv0a2rKDw4eAU928mBe8tbPasE,
|
|
1905
|
-
_nSkC1tXxFYa6LbR7LPXnxyyd2QHs1BF1IDNNB820PUo,
|
|
1906
|
-
_0A0qCCBv71rPYdBZ4homFqNY8vKqYhFYcpFzVFErwRs,
|
|
1907
|
-
_howp3jkhGMh82JLRw256Um6MRymSMasjTQ4BkPR_ERQ
|
|
1908
|
-
];
|
|
1909
|
-
|
|
1910
|
-
const assets = {};
|
|
1911
|
-
|
|
1912
|
-
function readAsset (id) {
|
|
1913
|
-
const serverDir = dirname$1(fileURLToPath(globalThis._importMeta_.url));
|
|
1914
|
-
return promises.readFile(resolve$1(serverDir, assets[id].path))
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
const publicAssetBases = {"/_nuxt/builds/meta/":{"maxAge":31536000},"/_nuxt/builds/":{"maxAge":1}};
|
|
1918
|
-
|
|
1919
|
-
function isPublicAssetURL(id = '') {
|
|
1920
|
-
if (assets[id]) {
|
|
1921
|
-
return true
|
|
1922
|
-
}
|
|
1923
|
-
for (const base in publicAssetBases) {
|
|
1924
|
-
if (id.startsWith(base)) { return true }
|
|
1925
|
-
}
|
|
1926
|
-
return false
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
function getAsset (id) {
|
|
1930
|
-
return assets[id]
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
const METHODS = /* @__PURE__ */ new Set(["HEAD", "GET"]);
|
|
1934
|
-
const EncodingMap = { gzip: ".gz", br: ".br" };
|
|
1935
|
-
const _m9Xl2b = eventHandler((event) => {
|
|
1936
|
-
if (event.method && !METHODS.has(event.method)) {
|
|
1937
|
-
return;
|
|
1938
|
-
}
|
|
1939
|
-
let id = decodePath(
|
|
1940
|
-
withLeadingSlash(withoutTrailingSlash(parseURL(event.path).pathname))
|
|
1941
|
-
);
|
|
1942
|
-
let asset;
|
|
1943
|
-
const encodingHeader = String(
|
|
1944
|
-
getRequestHeader(event, "accept-encoding") || ""
|
|
1945
|
-
);
|
|
1946
|
-
const encodings = [
|
|
1947
|
-
...encodingHeader.split(",").map((e) => EncodingMap[e.trim()]).filter(Boolean).sort(),
|
|
1948
|
-
""
|
|
1949
|
-
];
|
|
1950
|
-
if (encodings.length > 1) {
|
|
1951
|
-
appendResponseHeader(event, "Vary", "Accept-Encoding");
|
|
1952
|
-
}
|
|
1953
|
-
for (const encoding of encodings) {
|
|
1954
|
-
for (const _id of [id + encoding, joinURL(id, "index.html" + encoding)]) {
|
|
1955
|
-
const _asset = getAsset(_id);
|
|
1956
|
-
if (_asset) {
|
|
1957
|
-
asset = _asset;
|
|
1958
|
-
id = _id;
|
|
1959
|
-
break;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
if (!asset) {
|
|
1964
|
-
if (isPublicAssetURL(id)) {
|
|
1965
|
-
removeResponseHeader(event, "Cache-Control");
|
|
1966
|
-
throw createError({ statusCode: 404 });
|
|
1967
|
-
}
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
const ifNotMatch = getRequestHeader(event, "if-none-match") === asset.etag;
|
|
1971
|
-
if (ifNotMatch) {
|
|
1972
|
-
setResponseStatus(event, 304, "Not Modified");
|
|
1973
|
-
return "";
|
|
1974
|
-
}
|
|
1975
|
-
const ifModifiedSinceH = getRequestHeader(event, "if-modified-since");
|
|
1976
|
-
const mtimeDate = new Date(asset.mtime);
|
|
1977
|
-
if (ifModifiedSinceH && asset.mtime && new Date(ifModifiedSinceH) >= mtimeDate) {
|
|
1978
|
-
setResponseStatus(event, 304, "Not Modified");
|
|
1979
|
-
return "";
|
|
1980
|
-
}
|
|
1981
|
-
if (asset.type && !getResponseHeader(event, "Content-Type")) {
|
|
1982
|
-
setResponseHeader(event, "Content-Type", asset.type);
|
|
1983
|
-
}
|
|
1984
|
-
if (asset.etag && !getResponseHeader(event, "ETag")) {
|
|
1985
|
-
setResponseHeader(event, "ETag", asset.etag);
|
|
1986
|
-
}
|
|
1987
|
-
if (asset.mtime && !getResponseHeader(event, "Last-Modified")) {
|
|
1988
|
-
setResponseHeader(event, "Last-Modified", mtimeDate.toUTCString());
|
|
1989
|
-
}
|
|
1990
|
-
if (asset.encoding && !getResponseHeader(event, "Content-Encoding")) {
|
|
1991
|
-
setResponseHeader(event, "Content-Encoding", asset.encoding);
|
|
1992
|
-
}
|
|
1993
|
-
if (asset.size > 0 && !getResponseHeader(event, "Content-Length")) {
|
|
1994
|
-
setResponseHeader(event, "Content-Length", asset.size);
|
|
1995
|
-
}
|
|
1996
|
-
return readAsset(id);
|
|
1997
|
-
});
|
|
1998
|
-
|
|
1999
|
-
const storage = prefixStorage(useStorage(), "i18n");
|
|
2000
|
-
function cachedFunctionI18n(fn, opts) {
|
|
2001
|
-
opts = { maxAge: 1, ...opts };
|
|
2002
|
-
const pending = {};
|
|
2003
|
-
async function get(key, resolver) {
|
|
2004
|
-
const isPending = pending[key];
|
|
2005
|
-
if (!isPending) {
|
|
2006
|
-
pending[key] = Promise.resolve(resolver());
|
|
2007
|
-
}
|
|
2008
|
-
try {
|
|
2009
|
-
return await pending[key];
|
|
2010
|
-
} finally {
|
|
2011
|
-
delete pending[key];
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
return async (...args) => {
|
|
2015
|
-
const key = [opts.name, opts.getKey(...args)].join(":").replace(/:\/$/, ":index");
|
|
2016
|
-
const maxAge = opts.maxAge ?? 1;
|
|
2017
|
-
const isCacheable = !opts.shouldBypassCache(...args) && maxAge >= 0;
|
|
2018
|
-
const cache = isCacheable && await storage.getItemRaw(key);
|
|
2019
|
-
if (!cache || cache.ttl < Date.now()) {
|
|
2020
|
-
pending[key] = Promise.resolve(fn(...args));
|
|
2021
|
-
const value = await get(key, () => fn(...args));
|
|
2022
|
-
if (isCacheable) {
|
|
2023
|
-
await storage.setItemRaw(key, { ttl: Date.now() + maxAge * 1e3, value, mtime: Date.now() });
|
|
2024
|
-
}
|
|
2025
|
-
return value;
|
|
2026
|
-
}
|
|
2027
|
-
return cache.value;
|
|
2028
|
-
};
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
const _getMessages = async (locale) => {
|
|
2032
|
-
return { [locale]: await getLocaleMessagesMerged(locale, localeLoaders[locale]) };
|
|
2033
|
-
};
|
|
2034
|
-
cachedFunctionI18n(_getMessages, {
|
|
2035
|
-
name: "messages",
|
|
2036
|
-
maxAge: -1 ,
|
|
2037
|
-
getKey: (locale) => locale,
|
|
2038
|
-
shouldBypassCache: (locale) => !isLocaleCacheable(locale)
|
|
2039
|
-
});
|
|
2040
|
-
const getMessages = _getMessages ;
|
|
2041
|
-
const _getMergedMessages = async (locale, fallbackLocales) => {
|
|
2042
|
-
const merged = {};
|
|
2043
|
-
try {
|
|
2044
|
-
if (fallbackLocales.length > 0) {
|
|
2045
|
-
const messages = await Promise.all(fallbackLocales.map(getMessages));
|
|
2046
|
-
for (const message2 of messages) {
|
|
2047
|
-
deepCopy(message2, merged);
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
const message = await getMessages(locale);
|
|
2051
|
-
deepCopy(message, merged);
|
|
2052
|
-
return merged;
|
|
2053
|
-
} catch (e) {
|
|
2054
|
-
throw new Error("Failed to merge messages: " + e.message);
|
|
2055
|
-
}
|
|
2056
|
-
};
|
|
2057
|
-
const getMergedMessages = cachedFunctionI18n(_getMergedMessages, {
|
|
2058
|
-
name: "merged-single",
|
|
2059
|
-
maxAge: -1 ,
|
|
2060
|
-
getKey: (locale, fallbackLocales) => `${locale}-[${[...new Set(fallbackLocales)].sort().join("-")}]`,
|
|
2061
|
-
shouldBypassCache: (locale, fallbackLocales) => !isLocaleWithFallbacksCacheable(locale, fallbackLocales)
|
|
2062
|
-
});
|
|
2063
|
-
const _getAllMergedMessages = async (locales) => {
|
|
2064
|
-
const merged = {};
|
|
2065
|
-
try {
|
|
2066
|
-
const messages = await Promise.all(locales.map(getMessages));
|
|
2067
|
-
for (const message of messages) {
|
|
2068
|
-
deepCopy(message, merged);
|
|
2069
|
-
}
|
|
2070
|
-
return merged;
|
|
2071
|
-
} catch (e) {
|
|
2072
|
-
throw new Error("Failed to merge messages: " + e.message);
|
|
2073
|
-
}
|
|
2074
|
-
};
|
|
2075
|
-
cachedFunctionI18n(_getAllMergedMessages, {
|
|
2076
|
-
name: "merged-all",
|
|
2077
|
-
maxAge: -1 ,
|
|
2078
|
-
getKey: (locales) => locales.join("-"),
|
|
2079
|
-
shouldBypassCache: (locales) => !locales.every((locale) => isLocaleCacheable(locale))
|
|
2080
|
-
});
|
|
2081
|
-
|
|
2082
|
-
const _messagesHandler = defineEventHandler(async (event) => {
|
|
2083
|
-
const locale = getRouterParam(event, "locale");
|
|
2084
|
-
if (!locale) {
|
|
2085
|
-
throw createError({ status: 400, message: "Locale not specified." });
|
|
2086
|
-
}
|
|
2087
|
-
const ctx = useI18nContext(event);
|
|
2088
|
-
if (ctx.localeConfigs && locale in ctx.localeConfigs === false) {
|
|
2089
|
-
throw createError({ status: 404, message: `Locale '${locale}' not found.` });
|
|
2090
|
-
}
|
|
2091
|
-
const messages = await getMergedMessages(locale, ctx.localeConfigs?.[locale]?.fallbacks ?? []);
|
|
2092
|
-
deepCopy(messages, ctx.messages);
|
|
2093
|
-
return ctx.messages;
|
|
2094
|
-
});
|
|
2095
|
-
const _cachedMessageLoader = defineCachedFunction(_messagesHandler, {
|
|
2096
|
-
name: "i18n:messages-internal",
|
|
2097
|
-
maxAge: -1 ,
|
|
2098
|
-
getKey: (event) => getRouterParam(event, "locale") ?? "null",
|
|
2099
|
-
shouldBypassCache(event) {
|
|
2100
|
-
const locale = getRouterParam(event, "locale");
|
|
2101
|
-
if (locale == null) return false;
|
|
2102
|
-
return !useI18nContext(event).localeConfigs?.[locale]?.cacheable;
|
|
2103
|
-
}
|
|
2104
|
-
});
|
|
2105
|
-
defineCachedEventHandler(_cachedMessageLoader, {
|
|
2106
|
-
name: "i18n:messages",
|
|
2107
|
-
maxAge: -1 ,
|
|
2108
|
-
swr: false,
|
|
2109
|
-
getKey: (event) => getRouterParam(event, "locale") ?? "null"
|
|
2110
|
-
});
|
|
2111
|
-
const _mHe9OO = _messagesHandler ;
|
|
2112
|
-
|
|
2113
|
-
const VueResolver = (_, value) => {
|
|
2114
|
-
return isRef(value) ? toValue(value) : value;
|
|
2115
|
-
};
|
|
2116
|
-
|
|
2117
|
-
const headSymbol = "usehead";
|
|
2118
|
-
function vueInstall(head) {
|
|
2119
|
-
const plugin = {
|
|
2120
|
-
install(app) {
|
|
2121
|
-
app.config.globalProperties.$unhead = head;
|
|
2122
|
-
app.config.globalProperties.$head = head;
|
|
2123
|
-
app.provide(headSymbol, head);
|
|
2124
|
-
}
|
|
2125
|
-
};
|
|
2126
|
-
return plugin.install;
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
function resolveUnrefHeadInput(input) {
|
|
2130
|
-
return walkResolver(input, VueResolver);
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
function createHead(options = {}) {
|
|
2134
|
-
const head = createHead$1({
|
|
2135
|
-
...options,
|
|
2136
|
-
propResolvers: [VueResolver]
|
|
2137
|
-
});
|
|
2138
|
-
head.install = vueInstall(head);
|
|
2139
|
-
return head;
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
const unheadOptions = {
|
|
2143
|
-
disableDefaults: true,
|
|
2144
|
-
};
|
|
2145
|
-
|
|
2146
|
-
function createSSRContext(event) {
|
|
2147
|
-
const ssrContext = {
|
|
2148
|
-
url: event.path,
|
|
2149
|
-
event,
|
|
2150
|
-
runtimeConfig: useRuntimeConfig(event),
|
|
2151
|
-
noSSR: event.context.nuxt?.noSSR || (false),
|
|
2152
|
-
head: createHead(unheadOptions),
|
|
2153
|
-
error: false,
|
|
2154
|
-
nuxt: void 0,
|
|
2155
|
-
/* NuxtApp */
|
|
2156
|
-
payload: {},
|
|
2157
|
-
_payloadReducers: /* @__PURE__ */ Object.create(null),
|
|
2158
|
-
modules: /* @__PURE__ */ new Set()
|
|
2159
|
-
};
|
|
2160
|
-
return ssrContext;
|
|
2161
|
-
}
|
|
2162
|
-
function setSSRError(ssrContext, error) {
|
|
2163
|
-
ssrContext.error = true;
|
|
2164
|
-
ssrContext.payload = { error };
|
|
2165
|
-
ssrContext.url = error.url;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
function buildAssetsDir() {
|
|
2169
|
-
return useRuntimeConfig().app.buildAssetsDir;
|
|
2170
|
-
}
|
|
2171
|
-
function buildAssetsURL(...path) {
|
|
2172
|
-
return joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
|
|
2173
|
-
}
|
|
2174
|
-
function publicAssetsURL(...path) {
|
|
2175
|
-
const app = useRuntimeConfig().app;
|
|
2176
|
-
const publicBase = app.cdnURL || app.baseURL;
|
|
2177
|
-
return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
|
|
2181
|
-
const APP_ROOT_CLOSE_TAG = `</${appRootTag}>`;
|
|
2182
|
-
const getServerEntry = () => import('file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/.nuxt//dist/server/server.mjs').then((r) => r.default || r);
|
|
2183
|
-
const getClientManifest = () => import('file:///home/devin/projects/Cryobank/nuxt-layers/layers/base/.nuxt//dist/server/client.manifest.mjs').then((r) => r.default || r).then((r) => typeof r === "function" ? r() : r);
|
|
2184
|
-
const getSSRRenderer = lazyCachedFunction(async () => {
|
|
2185
|
-
const manifest = await getClientManifest();
|
|
2186
|
-
if (!manifest) {
|
|
2187
|
-
throw new Error("client.manifest is not available");
|
|
2188
|
-
}
|
|
2189
|
-
const createSSRApp = await getServerEntry();
|
|
2190
|
-
if (!createSSRApp) {
|
|
2191
|
-
throw new Error("Server bundle is not available");
|
|
2192
|
-
}
|
|
2193
|
-
const options = {
|
|
2194
|
-
manifest,
|
|
2195
|
-
renderToString: renderToString$1,
|
|
2196
|
-
buildAssetsURL
|
|
2197
|
-
};
|
|
2198
|
-
const renderer = createRenderer(createSSRApp, options);
|
|
2199
|
-
async function renderToString$1(input, context) {
|
|
2200
|
-
const html = await renderToString(input, context);
|
|
2201
|
-
if (process.env.NUXT_VITE_NODE_OPTIONS) {
|
|
2202
|
-
renderer.rendererContext.updateManifest(await getClientManifest());
|
|
2203
|
-
}
|
|
2204
|
-
return APP_ROOT_OPEN_TAG + html + APP_ROOT_CLOSE_TAG;
|
|
2205
|
-
}
|
|
2206
|
-
return renderer;
|
|
2207
|
-
});
|
|
2208
|
-
const getSPARenderer = lazyCachedFunction(async () => {
|
|
2209
|
-
const manifest = await getClientManifest();
|
|
2210
|
-
const spaTemplate = await Promise.resolve().then(function () { return _virtual__spaTemplate; }).then((r) => r.template).catch(() => "").then((r) => {
|
|
2211
|
-
{
|
|
2212
|
-
const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`;
|
|
2213
|
-
const APP_SPA_LOADER_CLOSE_TAG = `</${appSpaLoaderTag}>`;
|
|
2214
|
-
const appTemplate = APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG;
|
|
2215
|
-
const loaderTemplate = r ? APP_SPA_LOADER_OPEN_TAG + r + APP_SPA_LOADER_CLOSE_TAG : "";
|
|
2216
|
-
return appTemplate + loaderTemplate;
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2219
|
-
const options = {
|
|
2220
|
-
manifest,
|
|
2221
|
-
renderToString: () => spaTemplate,
|
|
2222
|
-
buildAssetsURL
|
|
2223
|
-
};
|
|
2224
|
-
const renderer = createRenderer(() => () => {
|
|
2225
|
-
}, options);
|
|
2226
|
-
const result = await renderer.renderToString({});
|
|
2227
|
-
const renderToString = (ssrContext) => {
|
|
2228
|
-
const config = useRuntimeConfig(ssrContext.event);
|
|
2229
|
-
ssrContext.modules ||= /* @__PURE__ */ new Set();
|
|
2230
|
-
ssrContext.payload.serverRendered = false;
|
|
2231
|
-
ssrContext.config = {
|
|
2232
|
-
public: config.public,
|
|
2233
|
-
app: config.app
|
|
2234
|
-
};
|
|
2235
|
-
return Promise.resolve(result);
|
|
2236
|
-
};
|
|
2237
|
-
return {
|
|
2238
|
-
rendererContext: renderer.rendererContext,
|
|
2239
|
-
renderToString
|
|
2240
|
-
};
|
|
2241
|
-
});
|
|
2242
|
-
function lazyCachedFunction(fn) {
|
|
2243
|
-
let res = null;
|
|
2244
|
-
return () => {
|
|
2245
|
-
if (res === null) {
|
|
2246
|
-
res = fn().catch((err) => {
|
|
2247
|
-
res = null;
|
|
2248
|
-
throw err;
|
|
2249
|
-
});
|
|
2250
|
-
}
|
|
2251
|
-
return res;
|
|
2252
|
-
};
|
|
2253
|
-
}
|
|
2254
|
-
function getRenderer(ssrContext) {
|
|
2255
|
-
return ssrContext.noSSR ? getSPARenderer() : getSSRRenderer();
|
|
2256
|
-
}
|
|
2257
|
-
const getSSRStyles = lazyCachedFunction(() => Promise.resolve().then(function () { return styles$1; }).then((r) => r.default || r));
|
|
2258
|
-
|
|
2259
|
-
async function renderInlineStyles(usedModules) {
|
|
2260
|
-
const styleMap = await getSSRStyles();
|
|
2261
|
-
const inlinedStyles = /* @__PURE__ */ new Set();
|
|
2262
|
-
for (const mod of usedModules) {
|
|
2263
|
-
if (mod in styleMap && styleMap[mod]) {
|
|
2264
|
-
for (const style of await styleMap[mod]()) {
|
|
2265
|
-
inlinedStyles.add(style);
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
return Array.from(inlinedStyles).map((style) => ({ innerHTML: style }));
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
const ROOT_NODE_REGEX = new RegExp(`^<${appRootTag}[^>]*>([\\s\\S]*)<\\/${appRootTag}>$`);
|
|
2273
|
-
function getServerComponentHTML(body) {
|
|
2274
|
-
const match = body.match(ROOT_NODE_REGEX);
|
|
2275
|
-
return match?.[1] || body;
|
|
2276
|
-
}
|
|
2277
|
-
const SSR_SLOT_TELEPORT_MARKER = /^uid=([^;]*);slot=(.*)$/;
|
|
2278
|
-
const SSR_CLIENT_TELEPORT_MARKER = /^uid=([^;]*);client=(.*)$/;
|
|
2279
|
-
const SSR_CLIENT_SLOT_MARKER = /^island-slot=([^;]*);(.*)$/;
|
|
2280
|
-
function getSlotIslandResponse(ssrContext) {
|
|
2281
|
-
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.slots).length) {
|
|
2282
|
-
return void 0;
|
|
2283
|
-
}
|
|
2284
|
-
const response = {};
|
|
2285
|
-
for (const [name, slot] of Object.entries(ssrContext.islandContext.slots)) {
|
|
2286
|
-
response[name] = {
|
|
2287
|
-
...slot,
|
|
2288
|
-
fallback: ssrContext.teleports?.[`island-fallback=${name}`]
|
|
2289
|
-
};
|
|
2290
|
-
}
|
|
2291
|
-
return response;
|
|
2292
|
-
}
|
|
2293
|
-
function getClientIslandResponse(ssrContext) {
|
|
2294
|
-
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.components).length) {
|
|
2295
|
-
return void 0;
|
|
2296
|
-
}
|
|
2297
|
-
const response = {};
|
|
2298
|
-
for (const [clientUid, component] of Object.entries(ssrContext.islandContext.components)) {
|
|
2299
|
-
const html = ssrContext.teleports?.[clientUid]?.replaceAll("<!--teleport start anchor-->", "") || "";
|
|
2300
|
-
response[clientUid] = {
|
|
2301
|
-
...component,
|
|
2302
|
-
html,
|
|
2303
|
-
slots: getComponentSlotTeleport(clientUid, ssrContext.teleports ?? {})
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
return response;
|
|
2307
|
-
}
|
|
2308
|
-
function getComponentSlotTeleport(clientUid, teleports) {
|
|
2309
|
-
const entries = Object.entries(teleports);
|
|
2310
|
-
const slots = {};
|
|
2311
|
-
for (const [key, value] of entries) {
|
|
2312
|
-
const match = key.match(SSR_CLIENT_SLOT_MARKER);
|
|
2313
|
-
if (match) {
|
|
2314
|
-
const [, id, slot] = match;
|
|
2315
|
-
if (!slot || clientUid !== id) {
|
|
2316
|
-
continue;
|
|
2317
|
-
}
|
|
2318
|
-
slots[slot] = value;
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
return slots;
|
|
2322
|
-
}
|
|
2323
|
-
function replaceIslandTeleports(ssrContext, html) {
|
|
2324
|
-
const { teleports, islandContext } = ssrContext;
|
|
2325
|
-
if (islandContext || !teleports) {
|
|
2326
|
-
return html;
|
|
2327
|
-
}
|
|
2328
|
-
for (const key in teleports) {
|
|
2329
|
-
const matchClientComp = key.match(SSR_CLIENT_TELEPORT_MARKER);
|
|
2330
|
-
if (matchClientComp) {
|
|
2331
|
-
const [, uid, clientId] = matchClientComp;
|
|
2332
|
-
if (!uid || !clientId) {
|
|
2333
|
-
continue;
|
|
2334
|
-
}
|
|
2335
|
-
html = html.replace(new RegExp(` data-island-uid="${uid}" data-island-component="${clientId}"[^>]*>`), (full) => {
|
|
2336
|
-
return full + teleports[key];
|
|
2337
|
-
});
|
|
2338
|
-
continue;
|
|
2339
|
-
}
|
|
2340
|
-
const matchSlot = key.match(SSR_SLOT_TELEPORT_MARKER);
|
|
2341
|
-
if (matchSlot) {
|
|
2342
|
-
const [, uid, slot] = matchSlot;
|
|
2343
|
-
if (!uid || !slot) {
|
|
2344
|
-
continue;
|
|
2345
|
-
}
|
|
2346
|
-
html = html.replace(new RegExp(` data-island-uid="${uid}" data-island-slot="${slot}"[^>]*>`), (full) => {
|
|
2347
|
-
return full + teleports[key];
|
|
2348
|
-
});
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
return html;
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
const ISLAND_SUFFIX_RE = /\.json(\?.*)?$/;
|
|
2355
|
-
const _SxA8c9 = defineEventHandler(async (event) => {
|
|
2356
|
-
const nitroApp = useNitroApp();
|
|
2357
|
-
setResponseHeaders(event, {
|
|
2358
|
-
"content-type": "application/json;charset=utf-8",
|
|
2359
|
-
"x-powered-by": "Nuxt"
|
|
2360
|
-
});
|
|
2361
|
-
const islandContext = await getIslandContext(event);
|
|
2362
|
-
const ssrContext = {
|
|
2363
|
-
...createSSRContext(event),
|
|
2364
|
-
islandContext,
|
|
2365
|
-
noSSR: false,
|
|
2366
|
-
url: islandContext.url
|
|
2367
|
-
};
|
|
2368
|
-
const renderer = await getSSRRenderer();
|
|
2369
|
-
const renderResult = await renderer.renderToString(ssrContext).catch(async (error) => {
|
|
2370
|
-
await ssrContext.nuxt?.hooks.callHook("app:error", error);
|
|
2371
|
-
throw error;
|
|
2372
|
-
});
|
|
2373
|
-
const inlinedStyles = await renderInlineStyles(ssrContext.modules ?? []);
|
|
2374
|
-
await ssrContext.nuxt?.hooks.callHook("app:rendered", { ssrContext, renderResult });
|
|
2375
|
-
if (inlinedStyles.length) {
|
|
2376
|
-
ssrContext.head.push({ style: inlinedStyles });
|
|
2377
|
-
}
|
|
2378
|
-
{
|
|
2379
|
-
const { styles } = getRequestDependencies(ssrContext, renderer.rendererContext);
|
|
2380
|
-
const link = [];
|
|
2381
|
-
for (const resource of Object.values(styles)) {
|
|
2382
|
-
if ("inline" in getQuery(resource.file)) {
|
|
2383
|
-
continue;
|
|
2384
|
-
}
|
|
2385
|
-
if (resource.file.includes("scoped") && !resource.file.includes("pages/")) {
|
|
2386
|
-
link.push({ rel: "stylesheet", href: renderer.rendererContext.buildAssetsURL(resource.file), crossorigin: "" });
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
if (link.length) {
|
|
2390
|
-
ssrContext.head.push({ link }, { mode: "server" });
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
const islandHead = {};
|
|
2394
|
-
for (const entry of ssrContext.head.entries.values()) {
|
|
2395
|
-
for (const [key, value] of Object.entries(resolveUnrefHeadInput(entry.input))) {
|
|
2396
|
-
const currentValue = islandHead[key];
|
|
2397
|
-
if (Array.isArray(currentValue)) {
|
|
2398
|
-
currentValue.push(...value);
|
|
2399
|
-
}
|
|
2400
|
-
islandHead[key] = value;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
const islandResponse = {
|
|
2404
|
-
id: islandContext.id,
|
|
2405
|
-
head: islandHead,
|
|
2406
|
-
html: getServerComponentHTML(renderResult.html),
|
|
2407
|
-
components: getClientIslandResponse(ssrContext),
|
|
2408
|
-
slots: getSlotIslandResponse(ssrContext)
|
|
2409
|
-
};
|
|
2410
|
-
await nitroApp.hooks.callHook("render:island", islandResponse, { event, islandContext });
|
|
2411
|
-
return islandResponse;
|
|
2412
|
-
});
|
|
2413
|
-
async function getIslandContext(event) {
|
|
2414
|
-
let url = event.path || "";
|
|
2415
|
-
const componentParts = url.substring("/__nuxt_island".length + 1).replace(ISLAND_SUFFIX_RE, "").split("_");
|
|
2416
|
-
const hashId = componentParts.length > 1 ? componentParts.pop() : void 0;
|
|
2417
|
-
const componentName = componentParts.join("_");
|
|
2418
|
-
const context = event.method === "GET" ? getQuery$1(event) : await readBody(event);
|
|
2419
|
-
const ctx = {
|
|
2420
|
-
url: "/",
|
|
2421
|
-
...context,
|
|
2422
|
-
id: hashId,
|
|
2423
|
-
name: componentName,
|
|
2424
|
-
props: destr$1(context.props) || {},
|
|
2425
|
-
slots: {},
|
|
2426
|
-
components: {}
|
|
2427
|
-
};
|
|
2428
|
-
return ctx;
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
const _lazy_CAlSS_ = () => Promise.resolve().then(function () { return loggly_post$1; });
|
|
2432
|
-
const _lazy_j4iPLZ = () => Promise.resolve().then(function () { return renderer$1; });
|
|
2433
|
-
|
|
2434
|
-
const handlers = [
|
|
2435
|
-
{ route: '', handler: _m9Xl2b, lazy: false, middleware: true, method: undefined },
|
|
2436
|
-
{ route: '/api/loggly', handler: _lazy_CAlSS_, lazy: true, middleware: false, method: "post" },
|
|
2437
|
-
{ route: '/__nuxt_error', handler: _lazy_j4iPLZ, lazy: true, middleware: false, method: undefined },
|
|
2438
|
-
{ route: '/_i18n/:locale/messages.json', handler: _mHe9OO, lazy: false, middleware: false, method: undefined },
|
|
2439
|
-
{ route: '/__nuxt_island/**', handler: _SxA8c9, lazy: false, middleware: false, method: undefined },
|
|
2440
|
-
{ route: '/**', handler: _lazy_j4iPLZ, lazy: true, middleware: false, method: undefined }
|
|
2441
|
-
];
|
|
2442
|
-
|
|
2443
|
-
function createNitroApp() {
|
|
2444
|
-
const config = useRuntimeConfig();
|
|
2445
|
-
const hooks = createHooks();
|
|
2446
|
-
const captureError = (error, context = {}) => {
|
|
2447
|
-
const promise = hooks.callHookParallel("error", error, context).catch((error_) => {
|
|
2448
|
-
console.error("Error while capturing another error", error_);
|
|
2449
|
-
});
|
|
2450
|
-
if (context.event && isEvent(context.event)) {
|
|
2451
|
-
const errors = context.event.context.nitro?.errors;
|
|
2452
|
-
if (errors) {
|
|
2453
|
-
errors.push({ error, context });
|
|
2454
|
-
}
|
|
2455
|
-
if (context.event.waitUntil) {
|
|
2456
|
-
context.event.waitUntil(promise);
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
};
|
|
2460
|
-
const h3App = createApp({
|
|
2461
|
-
debug: destr(true),
|
|
2462
|
-
onError: (error, event) => {
|
|
2463
|
-
captureError(error, { event, tags: ["request"] });
|
|
2464
|
-
return errorHandler(error, event);
|
|
2465
|
-
},
|
|
2466
|
-
onRequest: async (event) => {
|
|
2467
|
-
event.context.nitro = event.context.nitro || { errors: [] };
|
|
2468
|
-
const fetchContext = event.node.req?.__unenv__;
|
|
2469
|
-
if (fetchContext?._platform) {
|
|
2470
|
-
event.context = {
|
|
2471
|
-
_platform: fetchContext?._platform,
|
|
2472
|
-
// #3335
|
|
2473
|
-
...fetchContext._platform,
|
|
2474
|
-
...event.context
|
|
2475
|
-
};
|
|
2476
|
-
}
|
|
2477
|
-
if (!event.context.waitUntil && fetchContext?.waitUntil) {
|
|
2478
|
-
event.context.waitUntil = fetchContext.waitUntil;
|
|
2479
|
-
}
|
|
2480
|
-
event.fetch = (req, init) => fetchWithEvent(event, req, init, { fetch: localFetch });
|
|
2481
|
-
event.$fetch = (req, init) => fetchWithEvent(event, req, init, {
|
|
2482
|
-
fetch: $fetch
|
|
2483
|
-
});
|
|
2484
|
-
event.waitUntil = (promise) => {
|
|
2485
|
-
if (!event.context.nitro._waitUntilPromises) {
|
|
2486
|
-
event.context.nitro._waitUntilPromises = [];
|
|
2487
|
-
}
|
|
2488
|
-
event.context.nitro._waitUntilPromises.push(promise);
|
|
2489
|
-
if (event.context.waitUntil) {
|
|
2490
|
-
event.context.waitUntil(promise);
|
|
2491
|
-
}
|
|
2492
|
-
};
|
|
2493
|
-
event.captureError = (error, context) => {
|
|
2494
|
-
captureError(error, { event, ...context });
|
|
2495
|
-
};
|
|
2496
|
-
await nitroApp$1.hooks.callHook("request", event).catch((error) => {
|
|
2497
|
-
captureError(error, { event, tags: ["request"] });
|
|
2498
|
-
});
|
|
2499
|
-
},
|
|
2500
|
-
onBeforeResponse: async (event, response) => {
|
|
2501
|
-
await nitroApp$1.hooks.callHook("beforeResponse", event, response).catch((error) => {
|
|
2502
|
-
captureError(error, { event, tags: ["request", "response"] });
|
|
2503
|
-
});
|
|
2504
|
-
},
|
|
2505
|
-
onAfterResponse: async (event, response) => {
|
|
2506
|
-
await nitroApp$1.hooks.callHook("afterResponse", event, response).catch((error) => {
|
|
2507
|
-
captureError(error, { event, tags: ["request", "response"] });
|
|
2508
|
-
});
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
const router = createRouter$1({
|
|
2512
|
-
preemptive: true
|
|
2513
|
-
});
|
|
2514
|
-
const nodeHandler = toNodeListener(h3App);
|
|
2515
|
-
const localCall = (aRequest) => callNodeRequestHandler(nodeHandler, aRequest);
|
|
2516
|
-
const localFetch = (input, init) => {
|
|
2517
|
-
if (!input.toString().startsWith("/")) {
|
|
2518
|
-
return globalThis.fetch(input, init);
|
|
2519
|
-
}
|
|
2520
|
-
return fetchNodeRequestHandler(
|
|
2521
|
-
nodeHandler,
|
|
2522
|
-
input,
|
|
2523
|
-
init
|
|
2524
|
-
).then((response) => normalizeFetchResponse(response));
|
|
2525
|
-
};
|
|
2526
|
-
const $fetch = createFetch({
|
|
2527
|
-
fetch: localFetch,
|
|
2528
|
-
Headers: Headers$1,
|
|
2529
|
-
defaults: { baseURL: config.app.baseURL }
|
|
2530
|
-
});
|
|
2531
|
-
globalThis.$fetch = $fetch;
|
|
2532
|
-
h3App.use(createRouteRulesHandler({ localFetch }));
|
|
2533
|
-
for (const h of handlers) {
|
|
2534
|
-
let handler = h.lazy ? lazyEventHandler(h.handler) : h.handler;
|
|
2535
|
-
if (h.middleware || !h.route) {
|
|
2536
|
-
const middlewareBase = (config.app.baseURL + (h.route || "/")).replace(
|
|
2537
|
-
/\/+/g,
|
|
2538
|
-
"/"
|
|
2539
|
-
);
|
|
2540
|
-
h3App.use(middlewareBase, handler);
|
|
2541
|
-
} else {
|
|
2542
|
-
const routeRules = getRouteRulesForPath(
|
|
2543
|
-
h.route.replace(/:\w+|\*\*/g, "_")
|
|
2544
|
-
);
|
|
2545
|
-
if (routeRules.cache) {
|
|
2546
|
-
handler = cachedEventHandler(handler, {
|
|
2547
|
-
group: "nitro/routes",
|
|
2548
|
-
...routeRules.cache
|
|
2549
|
-
});
|
|
2550
|
-
}
|
|
2551
|
-
router.use(h.route, handler, h.method);
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
h3App.use(config.app.baseURL, router.handler);
|
|
2555
|
-
const app = {
|
|
2556
|
-
hooks,
|
|
2557
|
-
h3App,
|
|
2558
|
-
router,
|
|
2559
|
-
localCall,
|
|
2560
|
-
localFetch,
|
|
2561
|
-
captureError
|
|
2562
|
-
};
|
|
2563
|
-
return app;
|
|
2564
|
-
}
|
|
2565
|
-
function runNitroPlugins(nitroApp2) {
|
|
2566
|
-
for (const plugin of plugins) {
|
|
2567
|
-
try {
|
|
2568
|
-
plugin(nitroApp2);
|
|
2569
|
-
} catch (error) {
|
|
2570
|
-
nitroApp2.captureError(error, { tags: ["plugin"] });
|
|
2571
|
-
throw error;
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
const nitroApp$1 = createNitroApp();
|
|
2576
|
-
function useNitroApp() {
|
|
2577
|
-
return nitroApp$1;
|
|
2578
|
-
}
|
|
2579
|
-
runNitroPlugins(nitroApp$1);
|
|
2580
|
-
|
|
2581
|
-
function defineRenderHandler(render) {
|
|
2582
|
-
const runtimeConfig = useRuntimeConfig();
|
|
2583
|
-
return eventHandler(async (event) => {
|
|
2584
|
-
const nitroApp = useNitroApp();
|
|
2585
|
-
const ctx = { event, render, response: void 0 };
|
|
2586
|
-
await nitroApp.hooks.callHook("render:before", ctx);
|
|
2587
|
-
if (!ctx.response) {
|
|
2588
|
-
if (event.path === `${runtimeConfig.app.baseURL}favicon.ico`) {
|
|
2589
|
-
setResponseHeader(event, "Content-Type", "image/x-icon");
|
|
2590
|
-
return send(
|
|
2591
|
-
event,
|
|
2592
|
-
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
2593
|
-
);
|
|
2594
|
-
}
|
|
2595
|
-
ctx.response = await ctx.render(event);
|
|
2596
|
-
if (!ctx.response) {
|
|
2597
|
-
const _currentStatus = getResponseStatus(event);
|
|
2598
|
-
setResponseStatus(event, _currentStatus === 200 ? 500 : _currentStatus);
|
|
2599
|
-
return send(
|
|
2600
|
-
event,
|
|
2601
|
-
"No response returned from render handler: " + event.path
|
|
2602
|
-
);
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
await nitroApp.hooks.callHook("render:response", ctx.response, ctx);
|
|
2606
|
-
if (ctx.response.headers) {
|
|
2607
|
-
setResponseHeaders(event, ctx.response.headers);
|
|
2608
|
-
}
|
|
2609
|
-
if (ctx.response.statusCode || ctx.response.statusMessage) {
|
|
2610
|
-
setResponseStatus(
|
|
2611
|
-
event,
|
|
2612
|
-
ctx.response.statusCode,
|
|
2613
|
-
ctx.response.statusMessage
|
|
2614
|
-
);
|
|
2615
|
-
}
|
|
2616
|
-
return ctx.response.body;
|
|
2617
|
-
});
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
const scheduledTasks = false;
|
|
2621
|
-
|
|
2622
|
-
const tasks = {
|
|
2623
|
-
|
|
2624
|
-
};
|
|
2625
|
-
|
|
2626
|
-
const __runningTasks__ = {};
|
|
2627
|
-
async function runTask(name, {
|
|
2628
|
-
payload = {},
|
|
2629
|
-
context = {}
|
|
2630
|
-
} = {}) {
|
|
2631
|
-
if (__runningTasks__[name]) {
|
|
2632
|
-
return __runningTasks__[name];
|
|
2633
|
-
}
|
|
2634
|
-
if (!(name in tasks)) {
|
|
2635
|
-
throw createError({
|
|
2636
|
-
message: `Task \`${name}\` is not available!`,
|
|
2637
|
-
statusCode: 404
|
|
2638
|
-
});
|
|
2639
|
-
}
|
|
2640
|
-
if (!tasks[name].resolve) {
|
|
2641
|
-
throw createError({
|
|
2642
|
-
message: `Task \`${name}\` is not implemented!`,
|
|
2643
|
-
statusCode: 501
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
const handler = await tasks[name].resolve();
|
|
2647
|
-
const taskEvent = { name, payload, context };
|
|
2648
|
-
__runningTasks__[name] = handler.run(taskEvent);
|
|
2649
|
-
try {
|
|
2650
|
-
const res = await __runningTasks__[name];
|
|
2651
|
-
return res;
|
|
2652
|
-
} finally {
|
|
2653
|
-
delete __runningTasks__[name];
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
if (!globalThis.crypto) {
|
|
2658
|
-
globalThis.crypto = nodeCrypto;
|
|
2659
|
-
}
|
|
2660
|
-
const { NITRO_NO_UNIX_SOCKET, NITRO_DEV_WORKER_ID } = process.env;
|
|
2661
|
-
trapUnhandledNodeErrors();
|
|
2662
|
-
parentPort?.on("message", (msg) => {
|
|
2663
|
-
if (msg && msg.event === "shutdown") {
|
|
2664
|
-
shutdown();
|
|
2665
|
-
}
|
|
2666
|
-
});
|
|
2667
|
-
const nitroApp = useNitroApp();
|
|
2668
|
-
const server = new Server(toNodeListener(nitroApp.h3App));
|
|
2669
|
-
let listener;
|
|
2670
|
-
listen().catch(() => listen(
|
|
2671
|
-
true
|
|
2672
|
-
/* use random port */
|
|
2673
|
-
)).catch((error) => {
|
|
2674
|
-
console.error("Dev worker failed to listen:", error);
|
|
2675
|
-
return shutdown();
|
|
2676
|
-
});
|
|
2677
|
-
nitroApp.router.get(
|
|
2678
|
-
"/_nitro/tasks",
|
|
2679
|
-
defineEventHandler(async (event) => {
|
|
2680
|
-
const _tasks = await Promise.all(
|
|
2681
|
-
Object.entries(tasks).map(async ([name, task]) => {
|
|
2682
|
-
const _task = await task.resolve?.();
|
|
2683
|
-
return [name, { description: _task?.meta?.description }];
|
|
2684
|
-
})
|
|
2685
|
-
);
|
|
2686
|
-
return {
|
|
2687
|
-
tasks: Object.fromEntries(_tasks),
|
|
2688
|
-
scheduledTasks
|
|
2689
|
-
};
|
|
2690
|
-
})
|
|
2691
|
-
);
|
|
2692
|
-
nitroApp.router.use(
|
|
2693
|
-
"/_nitro/tasks/:name",
|
|
2694
|
-
defineEventHandler(async (event) => {
|
|
2695
|
-
const name = getRouterParam(event, "name");
|
|
2696
|
-
const payload = {
|
|
2697
|
-
...getQuery$1(event),
|
|
2698
|
-
...await readBody(event).then((r) => r?.payload).catch(() => ({}))
|
|
2699
|
-
};
|
|
2700
|
-
return await runTask(name, { payload });
|
|
2701
|
-
})
|
|
2702
|
-
);
|
|
2703
|
-
function listen(useRandomPort = Boolean(
|
|
2704
|
-
NITRO_NO_UNIX_SOCKET || process.versions.webcontainer || "Bun" in globalThis && process.platform === "win32"
|
|
2705
|
-
)) {
|
|
2706
|
-
return new Promise((resolve, reject) => {
|
|
2707
|
-
try {
|
|
2708
|
-
listener = server.listen(useRandomPort ? 0 : getSocketAddress(), () => {
|
|
2709
|
-
const address = server.address();
|
|
2710
|
-
parentPort?.postMessage({
|
|
2711
|
-
event: "listen",
|
|
2712
|
-
address: typeof address === "string" ? { socketPath: address } : { host: "localhost", port: address?.port }
|
|
2713
|
-
});
|
|
2714
|
-
resolve();
|
|
2715
|
-
});
|
|
2716
|
-
} catch (error) {
|
|
2717
|
-
reject(error);
|
|
2718
|
-
}
|
|
2719
|
-
});
|
|
2720
|
-
}
|
|
2721
|
-
function getSocketAddress() {
|
|
2722
|
-
const socketName = `nitro-worker-${process.pid}-${threadId}-${NITRO_DEV_WORKER_ID}-${Math.round(Math.random() * 1e4)}.sock`;
|
|
2723
|
-
if (process.platform === "win32") {
|
|
2724
|
-
return join(String.raw`\\.\pipe`, socketName);
|
|
2725
|
-
}
|
|
2726
|
-
if (process.platform === "linux") {
|
|
2727
|
-
const nodeMajor = Number.parseInt(process.versions.node.split(".")[0], 10);
|
|
2728
|
-
if (nodeMajor >= 20) {
|
|
2729
|
-
return `\0${socketName}`;
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
return join(tmpdir(), socketName);
|
|
2733
|
-
}
|
|
2734
|
-
async function shutdown() {
|
|
2735
|
-
server.closeAllConnections?.();
|
|
2736
|
-
await Promise.all([
|
|
2737
|
-
new Promise((resolve) => listener?.close(resolve)),
|
|
2738
|
-
nitroApp.hooks.callHook("close").catch(console.error)
|
|
2739
|
-
]);
|
|
2740
|
-
parentPort?.postMessage({ event: "exit" });
|
|
2741
|
-
}
|
|
2742
|
-
|
|
2743
|
-
const _messages = { "appName": "Nuxt", "statusCode": 500, "statusMessage": "Server error", "description": "An error occurred in the application and the page could not be served.", "stack": "" };
|
|
2744
|
-
const template$1 = (messages) => {
|
|
2745
|
-
messages = { ..._messages, ...messages };
|
|
2746
|
-
return '<!DOCTYPE html><html lang="en"><head><title>' + escapeHtml(messages.statusCode) + " - " + escapeHtml(messages.statusMessage || "Internal Server Error") + `</title><meta charset="utf-8"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0" name="viewport"><script>!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();<\/script><style>*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.absolute{position:absolute}.top-6{top:1.5rem}.z-10{z-index:10}.mx-auto{margin-left:auto;margin-right:auto}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.inline-block{display:inline-block}.h-auto{height:auto}.min-h-screen{min-height:100vh}.flex{display:flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.overflow-y-auto{overflow-y:auto}.border{border-width:1px}.border-b-0{border-bottom-width:0}.border-black\\/5{border-color:#0000000d}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.bg-gray-50\\/50{background-color:#f5f5f580}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.p-8{padding:2rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.pt-12{padding-top:3rem}.text-6xl{font-size:3.75rem;line-height:1}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-black{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.hover\\:text-\\[\\#00DC82\\]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.font-light{font-weight:300}.font-medium{font-weight:500}.leading-tight{line-height:1.25}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.hover\\:underline:hover{text-decoration-line:underline}.underline-offset-3{text-underline-offset:3px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\\:border-white\\/10{border-color:#ffffff1a}.dark\\:bg-\\[\\#020420\\]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\\:bg-white\\/5{background-color:#ffffff0d}.dark\\:text-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\\:right-6{right:1.5rem}.sm\\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:text-8xl{font-size:6rem;line-height:1}}</style></head><body class="antialiased bg-white dark:bg-[#020420] dark:text-white flex flex-col font-sans min-h-screen pt-12 px-10 text-black"><h1 class="font-medium mb-4 sm:text-8xl text-6xl">` + escapeHtml(messages.statusCode) + '</h1><p class="font-light leading-tight mb-8 sm:text-2xl text-xl">' + escapeHtml(messages.description) + '</p><a href="https://nuxt.com/docs/getting-started/error-handling?utm_source=nuxt-error-dev-page" target="_blank" class="absolute font-medium hover:text-[#00DC82] hover:underline inline-block mx-auto sm:right-6 text-sm top-6 underline-offset-3">Customize this page</a><div class="bg-gray-50/50 border border-b-0 border-black/5 dark:bg-white/5 dark:border-white/10 flex-1 h-auto overflow-y-auto rounded-t-md"><div class="font-light leading-tight p-8 text-xl z-10">' + escapeHtml(messages.stack) + "</div></div></body></html>";
|
|
2747
|
-
};
|
|
2748
|
-
|
|
2749
|
-
const errorDev = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2750
|
-
__proto__: null,
|
|
2751
|
-
template: template$1
|
|
2752
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2753
|
-
|
|
2754
|
-
const template = "";
|
|
2755
|
-
|
|
2756
|
-
const _virtual__spaTemplate = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2757
|
-
__proto__: null,
|
|
2758
|
-
template: template
|
|
2759
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2760
|
-
|
|
2761
|
-
const styles = {};
|
|
2762
|
-
|
|
2763
|
-
const styles$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2764
|
-
__proto__: null,
|
|
2765
|
-
default: styles
|
|
2766
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2767
|
-
|
|
2768
|
-
const sanitizeMeta = (input) => {
|
|
2769
|
-
if (!input || typeof input !== "object") return void 0;
|
|
2770
|
-
const blocked = ["password", "token", "authorization", "auth", "ssn", "creditcard", "credit_card"];
|
|
2771
|
-
const out = {};
|
|
2772
|
-
for (const [k, v] of Object.entries(input)) {
|
|
2773
|
-
out[k] = blocked.includes(k.toLowerCase()) ? "[REDACTED]" : v;
|
|
2774
|
-
}
|
|
2775
|
-
return out;
|
|
2776
|
-
};
|
|
2777
|
-
const serializeError = (err) => {
|
|
2778
|
-
var _a;
|
|
2779
|
-
if (!err || typeof err !== "object") return void 0;
|
|
2780
|
-
const e = err;
|
|
2781
|
-
return {
|
|
2782
|
-
name: e.name || "Error",
|
|
2783
|
-
message: String((_a = e.message) != null ? _a : "Error"),
|
|
2784
|
-
stack: typeof e.stack === "string" ? e.stack.split("\n").slice(0, 20) : void 0
|
|
2785
|
-
};
|
|
2786
|
-
};
|
|
2787
|
-
const loggly_post = defineEventHandler(async (event) => {
|
|
2788
|
-
var _a, _b;
|
|
2789
|
-
const { logglyToken, logglyEndpoint, public: pub } = useRuntimeConfig();
|
|
2790
|
-
if (!(pub == null ? void 0 : pub.logglyEnabled) || !logglyToken) {
|
|
2791
|
-
return { ok: false, skipped: true };
|
|
2792
|
-
}
|
|
2793
|
-
const body = await readBody(event);
|
|
2794
|
-
const scrubbed = {
|
|
2795
|
-
level: (_a = body == null ? void 0 : body.level) != null ? _a : "error",
|
|
2796
|
-
message: (_b = body == null ? void 0 : body.message) == null ? void 0 : _b.toString().slice(0, 5e3),
|
|
2797
|
-
tags: [.../* @__PURE__ */ new Set([...pub.logglyTags || [], ...(body == null ? void 0 : body.tags) || []])].slice(0, 10),
|
|
2798
|
-
meta: sanitizeMeta(body == null ? void 0 : body.meta),
|
|
2799
|
-
error: (body == null ? void 0 : body.error) ? serializeError(body.error) : void 0,
|
|
2800
|
-
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
2801
|
-
};
|
|
2802
|
-
const url = `${logglyEndpoint}/${encodeURIComponent(logglyToken)}/tag/${encodeURIComponent(scrubbed.tags.join(","))}`;
|
|
2803
|
-
try {
|
|
2804
|
-
await $fetch(url, { method: "POST", body: scrubbed });
|
|
2805
|
-
return { ok: true };
|
|
2806
|
-
} catch {
|
|
2807
|
-
return { ok: false };
|
|
2808
|
-
}
|
|
2809
|
-
});
|
|
2810
|
-
|
|
2811
|
-
const loggly_post$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2812
|
-
__proto__: null,
|
|
2813
|
-
default: loggly_post
|
|
2814
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2815
|
-
|
|
2816
|
-
function renderPayloadResponse(ssrContext) {
|
|
2817
|
-
return {
|
|
2818
|
-
body: stringify(splitPayload(ssrContext).payload, ssrContext._payloadReducers) ,
|
|
2819
|
-
statusCode: getResponseStatus(ssrContext.event),
|
|
2820
|
-
statusMessage: getResponseStatusText(ssrContext.event),
|
|
2821
|
-
headers: {
|
|
2822
|
-
"content-type": "application/json;charset=utf-8" ,
|
|
2823
|
-
"x-powered-by": "Nuxt"
|
|
2824
|
-
}
|
|
2825
|
-
};
|
|
2826
|
-
}
|
|
2827
|
-
function renderPayloadJsonScript(opts) {
|
|
2828
|
-
const contents = opts.data ? stringify(opts.data, opts.ssrContext._payloadReducers) : "";
|
|
2829
|
-
const payload = {
|
|
2830
|
-
"type": "application/json",
|
|
2831
|
-
"innerHTML": contents,
|
|
2832
|
-
"data-nuxt-data": appId,
|
|
2833
|
-
"data-ssr": !(opts.ssrContext.noSSR)
|
|
2834
|
-
};
|
|
2835
|
-
{
|
|
2836
|
-
payload.id = "__NUXT_DATA__";
|
|
2837
|
-
}
|
|
2838
|
-
if (opts.src) {
|
|
2839
|
-
payload["data-src"] = opts.src;
|
|
2840
|
-
}
|
|
2841
|
-
const config = uneval(opts.ssrContext.config);
|
|
2842
|
-
return [
|
|
2843
|
-
payload,
|
|
2844
|
-
{
|
|
2845
|
-
innerHTML: `window.__NUXT__={};window.__NUXT__.config=${config}`
|
|
2846
|
-
}
|
|
2847
|
-
];
|
|
2848
|
-
}
|
|
2849
|
-
function splitPayload(ssrContext) {
|
|
2850
|
-
const { data, prerenderedAt, ...initial } = ssrContext.payload;
|
|
2851
|
-
return {
|
|
2852
|
-
initial: { ...initial, prerenderedAt },
|
|
2853
|
-
payload: { data, prerenderedAt }
|
|
2854
|
-
};
|
|
2855
|
-
}
|
|
2856
|
-
|
|
2857
|
-
const renderSSRHeadOptions = {"omitLineBreaks":true};
|
|
2858
|
-
|
|
2859
|
-
globalThis.__buildAssetsURL = buildAssetsURL;
|
|
2860
|
-
globalThis.__publicAssetsURL = publicAssetsURL;
|
|
2861
|
-
const HAS_APP_TELEPORTS = !!(appTeleportAttrs.id);
|
|
2862
|
-
const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : "";
|
|
2863
|
-
const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : "";
|
|
2864
|
-
const PAYLOAD_URL_RE = /^[^?]*\/_payload.json(?:\?.*)?$/ ;
|
|
2865
|
-
const renderer = defineRenderHandler(async (event) => {
|
|
2866
|
-
const nitroApp = useNitroApp();
|
|
2867
|
-
const ssrError = event.path.startsWith("/__nuxt_error") ? getQuery$1(event) : null;
|
|
2868
|
-
if (ssrError && !("__unenv__" in event.node.req)) {
|
|
2869
|
-
throw createError({
|
|
2870
|
-
statusCode: 404,
|
|
2871
|
-
statusMessage: "Page Not Found: /__nuxt_error"
|
|
2872
|
-
});
|
|
2873
|
-
}
|
|
2874
|
-
const ssrContext = createSSRContext(event);
|
|
2875
|
-
const headEntryOptions = { mode: "server" };
|
|
2876
|
-
ssrContext.head.push(appHead, headEntryOptions);
|
|
2877
|
-
if (ssrError) {
|
|
2878
|
-
ssrError.statusCode &&= Number.parseInt(ssrError.statusCode);
|
|
2879
|
-
if (typeof ssrError.data === "string") {
|
|
2880
|
-
try {
|
|
2881
|
-
ssrError.data = destr(ssrError.data);
|
|
2882
|
-
} catch {
|
|
2883
|
-
}
|
|
2884
|
-
}
|
|
2885
|
-
setSSRError(ssrContext, ssrError);
|
|
2886
|
-
}
|
|
2887
|
-
const isRenderingPayload = PAYLOAD_URL_RE.test(ssrContext.url);
|
|
2888
|
-
if (isRenderingPayload) {
|
|
2889
|
-
const url = ssrContext.url.substring(0, ssrContext.url.lastIndexOf("/")) || "/";
|
|
2890
|
-
ssrContext.url = url;
|
|
2891
|
-
event._path = event.node.req.url = url;
|
|
2892
|
-
}
|
|
2893
|
-
const routeOptions = getRouteRules(event);
|
|
2894
|
-
if (routeOptions.ssr === false) {
|
|
2895
|
-
ssrContext.noSSR = true;
|
|
2896
|
-
}
|
|
2897
|
-
const renderer = await getRenderer(ssrContext);
|
|
2898
|
-
const _rendered = await renderer.renderToString(ssrContext).catch(async (error) => {
|
|
2899
|
-
if (ssrContext._renderResponse && error.message === "skipping render") {
|
|
2900
|
-
return {};
|
|
2901
|
-
}
|
|
2902
|
-
const _err = !ssrError && ssrContext.payload?.error || error;
|
|
2903
|
-
await ssrContext.nuxt?.hooks.callHook("app:error", _err);
|
|
2904
|
-
throw _err;
|
|
2905
|
-
});
|
|
2906
|
-
const inlinedStyles = [];
|
|
2907
|
-
await ssrContext.nuxt?.hooks.callHook("app:rendered", { ssrContext, renderResult: _rendered });
|
|
2908
|
-
if (ssrContext._renderResponse) {
|
|
2909
|
-
return ssrContext._renderResponse;
|
|
2910
|
-
}
|
|
2911
|
-
if (ssrContext.payload?.error && !ssrError) {
|
|
2912
|
-
throw ssrContext.payload.error;
|
|
2913
|
-
}
|
|
2914
|
-
if (isRenderingPayload) {
|
|
2915
|
-
const response = renderPayloadResponse(ssrContext);
|
|
2916
|
-
return response;
|
|
2917
|
-
}
|
|
2918
|
-
const NO_SCRIPTS = routeOptions.noScripts;
|
|
2919
|
-
const { styles, scripts } = getRequestDependencies(ssrContext, renderer.rendererContext);
|
|
2920
|
-
if (ssrContext._preloadManifest && !NO_SCRIPTS) {
|
|
2921
|
-
ssrContext.head.push({
|
|
2922
|
-
link: [
|
|
2923
|
-
{ rel: "preload", as: "fetch", fetchpriority: "low", crossorigin: "anonymous", href: buildAssetsURL(`builds/meta/${ssrContext.runtimeConfig.app.buildId}.json`) }
|
|
2924
|
-
]
|
|
2925
|
-
}, { ...headEntryOptions, tagPriority: "low" });
|
|
2926
|
-
}
|
|
2927
|
-
if (inlinedStyles.length) {
|
|
2928
|
-
ssrContext.head.push({ style: inlinedStyles });
|
|
2929
|
-
}
|
|
2930
|
-
const link = [];
|
|
2931
|
-
for (const resource of Object.values(styles)) {
|
|
2932
|
-
if ("inline" in getQuery(resource.file)) {
|
|
2933
|
-
continue;
|
|
2934
|
-
}
|
|
2935
|
-
link.push({ rel: "stylesheet", href: renderer.rendererContext.buildAssetsURL(resource.file), crossorigin: "" });
|
|
2936
|
-
}
|
|
2937
|
-
if (link.length) {
|
|
2938
|
-
ssrContext.head.push({ link }, headEntryOptions);
|
|
2939
|
-
}
|
|
2940
|
-
if (!NO_SCRIPTS) {
|
|
2941
|
-
ssrContext.head.push({
|
|
2942
|
-
link: getPreloadLinks(ssrContext, renderer.rendererContext)
|
|
2943
|
-
}, headEntryOptions);
|
|
2944
|
-
ssrContext.head.push({
|
|
2945
|
-
link: getPrefetchLinks(ssrContext, renderer.rendererContext)
|
|
2946
|
-
}, headEntryOptions);
|
|
2947
|
-
ssrContext.head.push({
|
|
2948
|
-
script: renderPayloadJsonScript({ ssrContext, data: ssrContext.payload })
|
|
2949
|
-
}, {
|
|
2950
|
-
...headEntryOptions,
|
|
2951
|
-
// this should come before another end of body scripts
|
|
2952
|
-
tagPosition: "bodyClose",
|
|
2953
|
-
tagPriority: "high"
|
|
2954
|
-
});
|
|
2955
|
-
}
|
|
2956
|
-
if (!routeOptions.noScripts) {
|
|
2957
|
-
const tagPosition = "head";
|
|
2958
|
-
ssrContext.head.push({
|
|
2959
|
-
script: Object.values(scripts).map((resource) => ({
|
|
2960
|
-
type: resource.module ? "module" : null,
|
|
2961
|
-
src: renderer.rendererContext.buildAssetsURL(resource.file),
|
|
2962
|
-
defer: resource.module ? null : true,
|
|
2963
|
-
// if we are rendering script tag payloads that import an async payload
|
|
2964
|
-
// we need to ensure this resolves before executing the Nuxt entry
|
|
2965
|
-
tagPosition,
|
|
2966
|
-
crossorigin: ""
|
|
2967
|
-
}))
|
|
2968
|
-
}, headEntryOptions);
|
|
2969
|
-
}
|
|
2970
|
-
const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = await renderSSRHead(ssrContext.head, renderSSRHeadOptions);
|
|
2971
|
-
const htmlContext = {
|
|
2972
|
-
htmlAttrs: htmlAttrs ? [htmlAttrs] : [],
|
|
2973
|
-
head: normalizeChunks([headTags]),
|
|
2974
|
-
bodyAttrs: bodyAttrs ? [bodyAttrs] : [],
|
|
2975
|
-
bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
|
|
2976
|
-
body: [
|
|
2977
|
-
replaceIslandTeleports(ssrContext, _rendered.html) ,
|
|
2978
|
-
APP_TELEPORT_OPEN_TAG + (HAS_APP_TELEPORTS ? joinTags([ssrContext.teleports?.[`#${appTeleportAttrs.id}`]]) : "") + APP_TELEPORT_CLOSE_TAG
|
|
2979
|
-
],
|
|
2980
|
-
bodyAppend: [bodyTags]
|
|
2981
|
-
};
|
|
2982
|
-
await nitroApp.hooks.callHook("render:html", htmlContext, { event });
|
|
2983
|
-
return {
|
|
2984
|
-
body: renderHTMLDocument(htmlContext),
|
|
2985
|
-
statusCode: getResponseStatus(event),
|
|
2986
|
-
statusMessage: getResponseStatusText(event),
|
|
2987
|
-
headers: {
|
|
2988
|
-
"content-type": "text/html;charset=utf-8",
|
|
2989
|
-
"x-powered-by": "Nuxt"
|
|
2990
|
-
}
|
|
2991
|
-
};
|
|
2992
|
-
});
|
|
2993
|
-
function normalizeChunks(chunks) {
|
|
2994
|
-
return chunks.filter(Boolean).map((i) => i.trim());
|
|
2995
|
-
}
|
|
2996
|
-
function joinTags(tags) {
|
|
2997
|
-
return tags.join("");
|
|
2998
|
-
}
|
|
2999
|
-
function joinAttrs(chunks) {
|
|
3000
|
-
if (chunks.length === 0) {
|
|
3001
|
-
return "";
|
|
3002
|
-
}
|
|
3003
|
-
return " " + chunks.join(" ");
|
|
3004
|
-
}
|
|
3005
|
-
function renderHTMLDocument(html) {
|
|
3006
|
-
return `<!DOCTYPE html><html${joinAttrs(html.htmlAttrs)}><head>${joinTags(html.head)}</head><body${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body></html>`;
|
|
3007
|
-
}
|
|
3008
|
-
|
|
3009
|
-
const renderer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
3010
|
-
__proto__: null,
|
|
3011
|
-
default: renderer
|
|
3012
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3013
|
-
//# sourceMappingURL=index.mjs.map
|