intial
This commit is contained in:
140
node_modules/.vite/deps_ssr/svelte.js
generated
vendored
Normal file
140
node_modules/.vite/deps_ssr/svelte.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
import { F as get_render_context, G as lifecycle_function_unavailable, H as ssr_context, I as createContext, L as getAllContexts, P as uneval, R as getContext, U as hydratable_clobbering, V as setContext, W as hydratable_serialization_failed, t as get_user_code_location, z as hasContext } from "./dev-uPqstlKb.js";
|
||||
import { ar as noop, sr as run, ur as experimental_async_required } from "./runtime-DInTlc-h.js";
|
||||
import { t as async_mode_flag } from "./flags-qfBdqUK7.js";
|
||||
// node_modules/svelte/src/internal/server/abort-signal.js
|
||||
function getAbortSignal() {
|
||||
let context = ssr_context;
|
||||
while (context !== null) {
|
||||
if (context.r !== null) return context.r.global.get_abort_signal();
|
||||
context = context.p;
|
||||
}
|
||||
return new AbortController().signal;
|
||||
}
|
||||
// node_modules/svelte/src/internal/server/hydratable.js
|
||||
/** @import { HydratableLookupEntry } from '#server' */
|
||||
/**
|
||||
* @template T
|
||||
* @param {string} key
|
||||
* @param {() => T} fn
|
||||
* @returns {T}
|
||||
*/
|
||||
function hydratable(key, fn) {
|
||||
if (!async_mode_flag) experimental_async_required("hydratable");
|
||||
const { hydratable } = get_render_context();
|
||||
let entry = hydratable.lookup.get(key);
|
||||
if (entry !== void 0) {
|
||||
{
|
||||
const comparison = compare(key, entry, encode(key, fn()));
|
||||
comparison.catch(() => {});
|
||||
hydratable.comparisons.push(comparison);
|
||||
}
|
||||
return entry.value;
|
||||
}
|
||||
const value = fn();
|
||||
entry = encode(key, value, hydratable.unresolved_promises);
|
||||
hydratable.lookup.set(key, entry);
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {any} value
|
||||
* @param {Map<Promise<any>, string>} [unresolved]
|
||||
*/
|
||||
function encode(key, value, unresolved) {
|
||||
/** @type {HydratableLookupEntry} */
|
||||
const entry = {
|
||||
value,
|
||||
serialized: ""
|
||||
};
|
||||
entry.stack = get_user_code_location();
|
||||
let uid = 1;
|
||||
entry.serialized = uneval(entry.value, (value, uneval) => {
|
||||
if (is_promise(value)) {
|
||||
const placeholder = `"${uid++}"`;
|
||||
const p = value.then((v) => {
|
||||
entry.serialized = entry.serialized.replace(placeholder, () => `r(${uneval(v)})`);
|
||||
}).catch((devalue_error) => hydratable_serialization_failed(key, serialization_stack(entry.stack, devalue_error?.stack)));
|
||||
unresolved?.set(p, key);
|
||||
p.catch(() => {}).finally(() => unresolved?.delete(p));
|
||||
(entry.promises ??= []).push(p);
|
||||
return placeholder;
|
||||
}
|
||||
});
|
||||
return entry;
|
||||
}
|
||||
/**
|
||||
* @param {any} value
|
||||
* @returns {value is Promise<any>}
|
||||
*/
|
||||
function is_promise(value) {
|
||||
return Object.prototype.toString.call(value) === "[object Promise]";
|
||||
}
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {HydratableLookupEntry} a
|
||||
* @param {HydratableLookupEntry} b
|
||||
*/
|
||||
async function compare(key, a, b) {
|
||||
for (const p of a?.promises ?? []) await p;
|
||||
for (const p of b?.promises ?? []) await p;
|
||||
if (a.serialized !== b.serialized) {
|
||||
const a_stack = a.stack;
|
||||
const b_stack = b.stack;
|
||||
const stack = a_stack === b_stack ? `Occurred at:\n${a_stack}` : `First occurrence at:\n${a_stack}\n\nSecond occurrence at:\n${b_stack}`;
|
||||
hydratable_clobbering(key, stack);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {string | undefined} root_stack
|
||||
* @param {string | undefined} uneval_stack
|
||||
*/
|
||||
function serialization_stack(root_stack, uneval_stack) {
|
||||
let out = "";
|
||||
if (root_stack) out += root_stack + "\n";
|
||||
if (uneval_stack) out += "Caused by:\n" + uneval_stack + "\n";
|
||||
return out || "<missing stack trace>";
|
||||
}
|
||||
// node_modules/svelte/src/internal/server/blocks/snippet.js
|
||||
/** @import { Snippet } from 'svelte' */
|
||||
/** @import { Renderer } from '../renderer' */
|
||||
/** @import { Getters } from '#shared' */
|
||||
/**
|
||||
* Create a snippet programmatically
|
||||
* @template {unknown[]} Params
|
||||
* @param {(...params: Getters<Params>) => {
|
||||
* render: () => string
|
||||
* setup?: (element: Element) => void | (() => void)
|
||||
* }} fn
|
||||
* @returns {Snippet<Params>}
|
||||
*/
|
||||
function createRawSnippet(fn) {
|
||||
return (renderer, ...args) => {
|
||||
var getters = args.map((value) => () => value);
|
||||
renderer.push(fn(...getters).render().trim());
|
||||
};
|
||||
}
|
||||
// node_modules/svelte/src/index-server.js
|
||||
/** @import { SSRContext } from '#server' */
|
||||
/** @import { Renderer } from './internal/server/renderer.js' */
|
||||
/** @param {() => void} fn */
|
||||
function onDestroy(fn) {
|
||||
/** @type {Renderer} */ ssr_context.r.on_destroy(fn);
|
||||
}
|
||||
function createEventDispatcher() {
|
||||
return noop;
|
||||
}
|
||||
function mount() {
|
||||
lifecycle_function_unavailable("mount");
|
||||
}
|
||||
function hydrate() {
|
||||
lifecycle_function_unavailable("hydrate");
|
||||
}
|
||||
function unmount() {
|
||||
lifecycle_function_unavailable("unmount");
|
||||
}
|
||||
function fork() {
|
||||
lifecycle_function_unavailable("fork");
|
||||
}
|
||||
async function tick() {}
|
||||
async function settled() {}
|
||||
export { noop as afterUpdate, noop as beforeUpdate, noop as flushSync, noop as onMount, createContext, createEventDispatcher, createRawSnippet, fork, getAbortSignal, getAllContexts, getContext, hasContext, hydratable, hydrate, mount, onDestroy, setContext, settled, tick, unmount, run as untrack };
|
||||
Reference in New Issue
Block a user