barebones docker | pocketbase | hono | svelte
This commit is contained in:
@@ -0,0 +1,749 @@
|
||||
import "./internal2.js";
|
||||
import { t as uneval } from "./uneval.js";
|
||||
import { $ as define_property, A as get_next_sibling, B as hydrate_node, C as get, D as clear_text_content, E as component_root, F as boundary, H as set_hydrate_node, I as component_context, J as hydration_failed, L as pop, M as mutable_source, N as set, O as create_text, P as flushSync, Q as array_from, R as push, S as active_reaction, T as set_active_reaction, U as set_hydrating, V as hydrating, W as hydration_mismatch, X as LEGACY_PROPS, Y as experimental_async_required, a as get_render_context, c as getContext, d as ssr_context, et as noop, h as getAbortSignal, j as init_operations, k as get_first_child, l as hasContext, m as lifecycle_function_unavailable, o as createContext, p as hydratable_serialization_failed, q as HYDRATION_ERROR, r as render, s as getAllContexts, t as derived, tt as run, u as setContext, v as is_passive_event, w as set_active_effect, x as active_effect, z as async_mode_flag } from "./async.js";
|
||||
//#region \0rolldown/runtime.js
|
||||
var __defProp = Object.defineProperty;
|
||||
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
||||
var __exportAll = (all, no_symbols) => {
|
||||
let target = {};
|
||||
for (var name in all) __defProp(target, name, {
|
||||
get: all[name],
|
||||
enumerable: true
|
||||
});
|
||||
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
||||
return target;
|
||||
};
|
||||
//#endregion
|
||||
//#region \0virtual:__sveltekit/env
|
||||
var explicit_public_env = {};
|
||||
var rendered_env = {};
|
||||
function set_env(env) {}
|
||||
//#endregion
|
||||
//#region \0virtual:__sveltekit/server
|
||||
var read_implementation = null;
|
||||
function set_read_implementation(fn) {
|
||||
read_implementation = fn;
|
||||
}
|
||||
function set_manifest(_) {}
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/elements/events.js
|
||||
/**
|
||||
* Used on elements, as a map of event type -> event handler,
|
||||
* and on events themselves to track which element handled an event
|
||||
*/
|
||||
var event_symbol = Symbol("events");
|
||||
/** @type {Set<string>} */
|
||||
var all_registered_events = /* @__PURE__ */ new Set();
|
||||
/** @type {Set<(events: Array<string>) => void>} */
|
||||
var root_event_handles = /* @__PURE__ */ new Set();
|
||||
var last_propagated_event = null;
|
||||
/**
|
||||
* @this {EventTarget}
|
||||
* @param {Event} event
|
||||
* @returns {void}
|
||||
*/
|
||||
function handle_event_propagation(event) {
|
||||
var handler_element = this;
|
||||
var owner_document = handler_element.ownerDocument;
|
||||
var event_name = event.type;
|
||||
var path = event.composedPath?.() || [];
|
||||
var current_target = path[0] || event.target;
|
||||
last_propagated_event = event;
|
||||
var path_idx = 0;
|
||||
var handled_at = last_propagated_event === event && event[event_symbol];
|
||||
if (handled_at) {
|
||||
var at_idx = path.indexOf(handled_at);
|
||||
if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
|
||||
event[event_symbol] = handler_element;
|
||||
return;
|
||||
}
|
||||
var handler_idx = path.indexOf(handler_element);
|
||||
if (handler_idx === -1) return;
|
||||
if (at_idx <= handler_idx) path_idx = at_idx;
|
||||
}
|
||||
current_target = path[path_idx] || event.target;
|
||||
if (current_target === handler_element) return;
|
||||
define_property(event, "currentTarget", {
|
||||
configurable: true,
|
||||
get() {
|
||||
return current_target || owner_document;
|
||||
}
|
||||
});
|
||||
var previous_reaction = active_reaction;
|
||||
var previous_effect = active_effect;
|
||||
set_active_reaction(null);
|
||||
set_active_effect(null);
|
||||
try {
|
||||
/**
|
||||
* @type {unknown}
|
||||
*/
|
||||
var throw_error;
|
||||
/**
|
||||
* @type {unknown[]}
|
||||
*/
|
||||
var other_errors = [];
|
||||
while (current_target !== null) {
|
||||
if (current_target === handler_element) break;
|
||||
try {
|
||||
var delegated = current_target[event_symbol]?.[event_name];
|
||||
if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
|
||||
} catch (error) {
|
||||
if (throw_error) other_errors.push(error);
|
||||
else throw_error = error;
|
||||
}
|
||||
if (event.cancelBubble) break;
|
||||
path_idx++;
|
||||
current_target = path_idx < path.length ? path[path_idx] : null;
|
||||
}
|
||||
if (throw_error) {
|
||||
for (let error of other_errors) queueMicrotask(() => {
|
||||
throw error;
|
||||
});
|
||||
throw throw_error;
|
||||
}
|
||||
} finally {
|
||||
event[event_symbol] = handler_element;
|
||||
delete event.currentTarget;
|
||||
set_active_reaction(previous_reaction);
|
||||
set_active_effect(previous_effect);
|
||||
}
|
||||
}
|
||||
globalThis?.window?.trustedTypes;
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/template.js
|
||||
/**
|
||||
* @param {TemplateNode} start
|
||||
* @param {TemplateNode | null} end
|
||||
*/
|
||||
function assign_nodes(start, end) {
|
||||
var effect = active_effect;
|
||||
if (effect.nodes === null) effect.nodes = {
|
||||
start,
|
||||
end,
|
||||
a: null,
|
||||
t: null
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
|
||||
* Transitions will play during the initial render unless the `intro` option is set to `false`.
|
||||
*
|
||||
* @template {Record<string, any>} Props
|
||||
* @template {Record<string, any>} Exports
|
||||
* @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
|
||||
* @param {MountOptions<Props>} options
|
||||
* @returns {Exports}
|
||||
*/
|
||||
function mount$1(component, options) {
|
||||
return _mount(component, options);
|
||||
}
|
||||
/**
|
||||
* Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component
|
||||
*
|
||||
* @template {Record<string, any>} Props
|
||||
* @template {Record<string, any>} Exports
|
||||
* @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
|
||||
* @param {{} extends Props ? {
|
||||
* target: Document | Element | ShadowRoot;
|
||||
* props?: Props;
|
||||
* events?: Record<string, (e: any) => any>;
|
||||
* context?: Map<any, any>;
|
||||
* intro?: boolean;
|
||||
* recover?: boolean;
|
||||
* transformError?: (error: unknown) => unknown;
|
||||
* } : {
|
||||
* target: Document | Element | ShadowRoot;
|
||||
* props: Props;
|
||||
* events?: Record<string, (e: any) => any>;
|
||||
* context?: Map<any, any>;
|
||||
* intro?: boolean;
|
||||
* recover?: boolean;
|
||||
* transformError?: (error: unknown) => unknown;
|
||||
* }} options
|
||||
* @returns {Exports}
|
||||
*/
|
||||
function hydrate$1(component, options) {
|
||||
init_operations();
|
||||
options.intro = options.intro ?? false;
|
||||
const target = options.target;
|
||||
const was_hydrating = hydrating;
|
||||
const previous_hydrate_node = hydrate_node;
|
||||
try {
|
||||
var anchor = /* @__PURE__ */ get_first_child(target);
|
||||
while (anchor && (anchor.nodeType !== 8 || anchor.data !== "[")) anchor = /* @__PURE__ */ get_next_sibling(anchor);
|
||||
if (!anchor) throw HYDRATION_ERROR;
|
||||
set_hydrating(true);
|
||||
set_hydrate_node(anchor);
|
||||
const instance = _mount(component, {
|
||||
...options,
|
||||
anchor
|
||||
});
|
||||
set_hydrating(false);
|
||||
return instance;
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) throw error;
|
||||
if (error !== HYDRATION_ERROR) console.warn("Failed to hydrate: ", error);
|
||||
if (options.recover === false) hydration_failed();
|
||||
init_operations();
|
||||
clear_text_content(target);
|
||||
set_hydrating(false);
|
||||
return mount$1(component, options);
|
||||
} finally {
|
||||
set_hydrating(was_hydrating);
|
||||
set_hydrate_node(previous_hydrate_node);
|
||||
}
|
||||
}
|
||||
/** @type {Map<EventTarget, Map<string, number>>} */
|
||||
var listeners = /* @__PURE__ */ new Map();
|
||||
/**
|
||||
* @template {Record<string, any>} Exports
|
||||
* @param {ComponentType<SvelteComponent<any>> | Component<any>} Component
|
||||
* @param {MountOptions} options
|
||||
* @returns {Exports}
|
||||
*/
|
||||
function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
|
||||
init_operations();
|
||||
/** @type {Exports} */
|
||||
var component = void 0;
|
||||
var unmount = component_root(() => {
|
||||
var anchor_node = anchor ?? target.appendChild(create_text());
|
||||
boundary(anchor_node, { pending: () => {} }, (anchor_node) => {
|
||||
push({});
|
||||
var ctx = component_context;
|
||||
if (context) ctx.c = context;
|
||||
if (events)
|
||||
/** @type {any} */ props.$$events = events;
|
||||
if (hydrating) assign_nodes(anchor_node, null);
|
||||
component = Component(anchor_node, props) || {};
|
||||
if (hydrating) {
|
||||
/** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
|
||||
if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
|
||||
hydration_mismatch();
|
||||
throw HYDRATION_ERROR;
|
||||
}
|
||||
}
|
||||
pop();
|
||||
}, transformError);
|
||||
/** @type {Set<string>} */
|
||||
var registered_events = /* @__PURE__ */ new Set();
|
||||
/** @param {Array<string>} events */
|
||||
var event_handle = (events) => {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var event_name = events[i];
|
||||
if (registered_events.has(event_name)) continue;
|
||||
registered_events.add(event_name);
|
||||
var passive = is_passive_event(event_name);
|
||||
for (const node of [target, document]) {
|
||||
var counts = listeners.get(node);
|
||||
if (counts === void 0) {
|
||||
counts = /* @__PURE__ */ new Map();
|
||||
listeners.set(node, counts);
|
||||
}
|
||||
var count = counts.get(event_name);
|
||||
if (count === void 0) {
|
||||
node.addEventListener(event_name, handle_event_propagation, { passive });
|
||||
counts.set(event_name, 1);
|
||||
} else counts.set(event_name, count + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
event_handle(array_from(all_registered_events));
|
||||
root_event_handles.add(event_handle);
|
||||
return () => {
|
||||
for (var event_name of registered_events) for (const node of [target, document]) {
|
||||
var counts = listeners.get(node);
|
||||
var count = counts.get(event_name);
|
||||
if (--count == 0) {
|
||||
node.removeEventListener(event_name, handle_event_propagation);
|
||||
counts.delete(event_name);
|
||||
if (counts.size === 0) listeners.delete(node);
|
||||
} else counts.set(event_name, count);
|
||||
}
|
||||
root_event_handles.delete(event_handle);
|
||||
if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node);
|
||||
};
|
||||
});
|
||||
mounted_components.set(component, unmount);
|
||||
return component;
|
||||
}
|
||||
/**
|
||||
* References of the components that were mounted or hydrated.
|
||||
* Uses a `WeakMap` to avoid memory leaks.
|
||||
*/
|
||||
var mounted_components = /* @__PURE__ */ new WeakMap();
|
||||
/**
|
||||
* Unmounts a component that was previously mounted using `mount` or `hydrate`.
|
||||
*
|
||||
* Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.
|
||||
*
|
||||
* Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).
|
||||
*
|
||||
* ```js
|
||||
* import { mount, unmount } from 'svelte';
|
||||
* import App from './App.svelte';
|
||||
*
|
||||
* const app = mount(App, { target: document.body });
|
||||
*
|
||||
* // later...
|
||||
* unmount(app, { outro: true });
|
||||
* ```
|
||||
* @param {Record<string, any>} component
|
||||
* @param {{ outro?: boolean }} [options]
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function unmount$1(component, options) {
|
||||
const fn = mounted_components.get(component);
|
||||
if (fn) {
|
||||
mounted_components.delete(component);
|
||||
return fn(options);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/legacy/legacy-client.js
|
||||
/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
|
||||
/**
|
||||
* Takes the component function and returns a Svelte 4 compatible component constructor.
|
||||
*
|
||||
* @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
|
||||
*
|
||||
* @template {Record<string, any>} Props
|
||||
* @template {Record<string, any>} Exports
|
||||
* @template {Record<string, any>} Events
|
||||
* @template {Record<string, any>} Slots
|
||||
*
|
||||
* @param {SvelteComponent<Props, Events, Slots> | Component<Props>} component
|
||||
* @returns {ComponentType<SvelteComponent<Props, Events, Slots> & Exports>}
|
||||
*/
|
||||
function asClassComponent$1(component) {
|
||||
return class extends Svelte4Component {
|
||||
/** @param {any} options */
|
||||
constructor(options) {
|
||||
super({
|
||||
component,
|
||||
...options
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Support using the component as both a class and function during the transition period
|
||||
* @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType
|
||||
*/
|
||||
var Svelte4Component = class {
|
||||
/** @type {any} */
|
||||
#events;
|
||||
/** @type {Record<string, any>} */
|
||||
#instance;
|
||||
/**
|
||||
* @param {ComponentConstructorOptions & {
|
||||
* component: any;
|
||||
* }} options
|
||||
*/
|
||||
constructor(options) {
|
||||
var sources = /* @__PURE__ */ new Map();
|
||||
/**
|
||||
* @param {string | symbol} key
|
||||
* @param {unknown} value
|
||||
*/
|
||||
var add_source = (key, value) => {
|
||||
var s = /* @__PURE__ */ mutable_source(value, false, false);
|
||||
sources.set(key, s);
|
||||
return s;
|
||||
};
|
||||
const props = new Proxy({
|
||||
...options.props || {},
|
||||
$$events: {}
|
||||
}, {
|
||||
get(target, prop) {
|
||||
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
||||
},
|
||||
has(target, prop) {
|
||||
if (prop === LEGACY_PROPS) return true;
|
||||
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
set(target, prop, value) {
|
||||
set(sources.get(prop) ?? add_source(prop, value), value);
|
||||
return Reflect.set(target, prop, value);
|
||||
}
|
||||
});
|
||||
this.#instance = (options.hydrate ? hydrate$1 : mount$1)(options.component, {
|
||||
target: options.target,
|
||||
anchor: options.anchor,
|
||||
props,
|
||||
context: options.context,
|
||||
intro: options.intro ?? false,
|
||||
recover: options.recover,
|
||||
transformError: options.transformError
|
||||
});
|
||||
if (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) flushSync();
|
||||
this.#events = props.$$events;
|
||||
for (const key of Object.keys(this.#instance)) {
|
||||
if (key === "$set" || key === "$destroy" || key === "$on") continue;
|
||||
define_property(this, key, {
|
||||
get() {
|
||||
return this.#instance[key];
|
||||
},
|
||||
/** @param {any} value */
|
||||
set(value) {
|
||||
this.#instance[key] = value;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
this.#instance.$set = (next) => {
|
||||
Object.assign(props, next);
|
||||
};
|
||||
this.#instance.$destroy = () => {
|
||||
unmount$1(this.#instance);
|
||||
};
|
||||
}
|
||||
/** @param {Record<string, any>} props */
|
||||
$set(props) {
|
||||
this.#instance.$set(props);
|
||||
}
|
||||
/**
|
||||
* @param {string} event
|
||||
* @param {(...args: any[]) => any} callback
|
||||
* @returns {any}
|
||||
*/
|
||||
$on(event, callback) {
|
||||
this.#events[event] = this.#events[event] || [];
|
||||
/** @param {any[]} args */
|
||||
const cb = (...args) => callback.call(this, ...args);
|
||||
this.#events[event].push(cb);
|
||||
return () => {
|
||||
this.#events[event] = this.#events[event].filter(
|
||||
/** @param {any} fn */
|
||||
(fn) => fn !== cb
|
||||
);
|
||||
};
|
||||
}
|
||||
$destroy() {
|
||||
this.#instance.$destroy();
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/legacy/legacy-server.js
|
||||
/** @import { SvelteComponent } from '../index.js' */
|
||||
/** @import { Csp } from '#server' */
|
||||
/** @typedef {{ head: string, html: string, css: { code: string, map: null }; hashes?: { script: `sha256-${string}`[] } }} LegacyRenderResult */
|
||||
/**
|
||||
* Takes a Svelte 5 component and returns a Svelte 4 compatible component constructor.
|
||||
*
|
||||
* @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
|
||||
*
|
||||
* @template {Record<string, any>} Props
|
||||
* @template {Record<string, any>} Exports
|
||||
* @template {Record<string, any>} Events
|
||||
* @template {Record<string, any>} Slots
|
||||
*
|
||||
* @param {SvelteComponent<Props, Events, Slots>} component
|
||||
* @returns {typeof SvelteComponent<Props, Events, Slots> & Exports}
|
||||
*/
|
||||
function asClassComponent(component) {
|
||||
const component_constructor = asClassComponent$1(component);
|
||||
/** @type {(props?: {}, opts?: { $$slots?: {}; context?: Map<any, any>; csp?: Csp; transformError?: (error: unknown) => unknown }) => LegacyRenderResult & PromiseLike<LegacyRenderResult> } */
|
||||
const _render = (props, { context, csp, transformError } = {}) => {
|
||||
const result = render(component, {
|
||||
props,
|
||||
context,
|
||||
csp,
|
||||
transformError
|
||||
});
|
||||
const munged = Object.defineProperties({}, {
|
||||
css: { value: {
|
||||
code: "",
|
||||
map: null
|
||||
} },
|
||||
head: { get: () => result.head },
|
||||
html: { get: () => result.body },
|
||||
then: {
|
||||
/**
|
||||
* this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
|
||||
*
|
||||
* @template TResult1
|
||||
* @template [TResult2=never]
|
||||
* @param { (value: LegacyRenderResult) => TResult1 } onfulfilled
|
||||
* @param { (reason: unknown) => TResult2 } onrejected
|
||||
*/
|
||||
value: (onfulfilled, onrejected) => {
|
||||
if (!async_mode_flag) {
|
||||
const user_result = onfulfilled({
|
||||
css: munged.css,
|
||||
head: munged.head,
|
||||
html: munged.html
|
||||
});
|
||||
return Promise.resolve(user_result);
|
||||
}
|
||||
return result.then((result) => {
|
||||
return onfulfilled({
|
||||
css: munged.css,
|
||||
head: result.head,
|
||||
html: result.body,
|
||||
hashes: result.hashes
|
||||
});
|
||||
}, onrejected);
|
||||
} }
|
||||
});
|
||||
return munged;
|
||||
};
|
||||
component_constructor.render = _render;
|
||||
return component_constructor;
|
||||
}
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/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) 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: ""
|
||||
};
|
||||
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 | 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>";
|
||||
}
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/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());
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/index-server.js
|
||||
/** @import { SSRContext } from '#server' */
|
||||
/** @import { Renderer } from './internal/server/renderer.js' */
|
||||
var index_server_exports = /* @__PURE__ */ __exportAll({
|
||||
afterUpdate: () => noop,
|
||||
beforeUpdate: () => noop,
|
||||
createContext: () => createContext,
|
||||
createEventDispatcher: () => createEventDispatcher,
|
||||
createRawSnippet: () => createRawSnippet,
|
||||
flushSync: () => noop,
|
||||
fork: () => fork,
|
||||
getAbortSignal: () => getAbortSignal,
|
||||
getAllContexts: () => getAllContexts,
|
||||
getContext: () => getContext,
|
||||
hasContext: () => hasContext,
|
||||
hydratable: () => hydratable,
|
||||
hydrate: () => hydrate,
|
||||
mount: () => mount,
|
||||
onDestroy: () => onDestroy,
|
||||
onMount: () => noop,
|
||||
setContext: () => setContext,
|
||||
settled: () => settled,
|
||||
tick: () => tick,
|
||||
unmount: () => unmount,
|
||||
untrack: () => run
|
||||
});
|
||||
/** @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() {}
|
||||
//#endregion
|
||||
//#region .svelte-kit/generated/root.svelte
|
||||
function Root($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer) => {
|
||||
let { stores, page, constructors, components = [], form, errors = [], error, data_0 = null, data_1 = null } = $$props;
|
||||
let data = derived(() => ({
|
||||
"0": data_0,
|
||||
"1": data_1
|
||||
}));
|
||||
setContext("__svelte__", stores);
|
||||
stores.page.set(page);
|
||||
derived(() => constructors[1]);
|
||||
function pyramid($$renderer, depth) {
|
||||
const Pyramid = constructors[depth];
|
||||
function failed($$renderer, error) {
|
||||
const ErrorPage = errors[depth];
|
||||
if (ErrorPage) {
|
||||
$$renderer.push("<!--[-->");
|
||||
ErrorPage($$renderer, { error });
|
||||
$$renderer.push("<!--]-->");
|
||||
} else {
|
||||
$$renderer.push("<!--[!-->");
|
||||
$$renderer.push("<!--]-->");
|
||||
}
|
||||
}
|
||||
$$renderer.boundary({ failed: errors[depth] ? failed : void 0 }, ($$renderer) => {
|
||||
$$renderer.push(`<!--[-->`);
|
||||
if (constructors[depth + 1]) {
|
||||
$$renderer.push("<!--[0-->");
|
||||
const d = data()[depth];
|
||||
if (Pyramid) {
|
||||
$$renderer.push("<!--[-->");
|
||||
Pyramid($$renderer, {
|
||||
data: d,
|
||||
form,
|
||||
params: page.params,
|
||||
children: ($$renderer) => {
|
||||
pyramid($$renderer, depth + 1);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push("<!--]-->");
|
||||
} else {
|
||||
$$renderer.push("<!--[!-->");
|
||||
$$renderer.push("<!--]-->");
|
||||
}
|
||||
} else {
|
||||
$$renderer.push("<!--[-1-->");
|
||||
const d = data()[depth];
|
||||
if (Pyramid) {
|
||||
$$renderer.push("<!--[-->");
|
||||
Pyramid($$renderer, {
|
||||
data: d,
|
||||
form,
|
||||
params: page.params,
|
||||
error
|
||||
});
|
||||
$$renderer.push("<!--]-->");
|
||||
} else {
|
||||
$$renderer.push("<!--[!-->");
|
||||
$$renderer.push("<!--]-->");
|
||||
}
|
||||
}
|
||||
$$renderer.push(`<!--]-->`);
|
||||
$$renderer.push(`<!--]-->`);
|
||||
});
|
||||
}
|
||||
pyramid($$renderer, 0);
|
||||
$$renderer.push(`<!----> `);
|
||||
$$renderer.push("<!--[-1-->");
|
||||
$$renderer.push(`<!--]-->`);
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
//#region .svelte-kit/generated/server/internal.js
|
||||
var options = {
|
||||
app_template_contains_nonce: false,
|
||||
async: true,
|
||||
csp: {
|
||||
"mode": "auto",
|
||||
"directives": {
|
||||
"upgrade-insecure-requests": false,
|
||||
"block-all-mixed-content": false
|
||||
},
|
||||
"reportOnly": {
|
||||
"upgrade-insecure-requests": false,
|
||||
"block-all-mixed-content": false
|
||||
}
|
||||
},
|
||||
csrf_check_origin: true,
|
||||
csrf_trusted_origins: [],
|
||||
embedded: false,
|
||||
hash_routing: false,
|
||||
hooks: null,
|
||||
link_header_preload: false,
|
||||
root: asClassComponent(Root),
|
||||
service_worker: false,
|
||||
service_worker_options: void 0,
|
||||
server_error_boundaries: true,
|
||||
templates: {
|
||||
app: ({ head, body, assets, nonce, env }) => "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"text-scale\" content=\"scale\" />\n " + head + "\n </head>\n <body data-sveltekit-preload-data=\"hover\">\n <div style=\"display: contents\">" + body + "</div>\n </body>\n</html>\n",
|
||||
error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>" + message + "</title>\n\n <style>\n body {\n --bg: white;\n --fg: #222;\n --divider: #ccc;\n background: var(--bg);\n color: var(--fg);\n font-family:\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Oxygen,\n Ubuntu,\n Cantarell,\n 'Open Sans',\n 'Helvetica Neue',\n sans-serif;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100vh;\n margin: 0;\n }\n\n .error {\n display: flex;\n align-items: center;\n max-width: 32rem;\n margin: 0 1rem;\n }\n\n .status {\n font-weight: 200;\n font-size: 3rem;\n line-height: 1;\n position: relative;\n top: -0.05rem;\n }\n\n .message {\n border-left: 1px solid var(--divider);\n padding: 0 0 0 1rem;\n margin: 0 0 0 1rem;\n min-height: 2.5rem;\n display: flex;\n align-items: center;\n }\n\n .message h1 {\n font-weight: 400;\n font-size: 1em;\n margin: 0;\n }\n\n @media (prefers-color-scheme: dark) {\n body {\n --bg: #222;\n --fg: #ddd;\n --divider: #666;\n }\n }\n </style>\n </head>\n <body>\n <div class=\"error\">\n <span class=\"status\">" + status + "</span>\n <div class=\"message\">\n <h1>" + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "1d1q9qt"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
let handleFetch;
|
||||
let handleError;
|
||||
let handleValidationError;
|
||||
let init;
|
||||
let reroute;
|
||||
let transport;
|
||||
return {
|
||||
handle,
|
||||
handleFetch,
|
||||
handleError,
|
||||
handleValidationError,
|
||||
init,
|
||||
reroute,
|
||||
transport
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
export { set_manifest as a, rendered_env as c, read_implementation as i, set_env as l, options as n, set_read_implementation as o, index_server_exports as r, explicit_public_env as s, get_hooks as t, __commonJSMin as u };
|
||||
Reference in New Issue
Block a user