All files / src index-server.js

86.95% Statements 40/46
100% Branches 3/3
42.85% Functions 3/7
86.95% Lines 40/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 471x 1x 1x 1x 1x 20x 20x 20x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 33x 33x 1x 1x     1x 1x     1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 1x 1x  
import { current_component } from './internal/server/context.js';
import { noop } from './internal/shared/utils.js';
 
/** @param {() => void} fn */
export function onDestroy(fn) {
	var context = /** @type {import('#server').Component} */ (current_component);
	(context.d ??= []).push(fn);
}
 
export {
	noop as beforeUpdate,
	noop as afterUpdate,
	noop as onMount,
	noop as flushSync,
	run as untrack
} from './internal/shared/utils.js';
 
export function createEventDispatcher() {
	return noop;
}
 
export function mount() {
	throw new Error('mount(...) is not available on the server');
}
 
export function hydrate() {
	throw new Error('hydrate(...) is not available on the server');
}
 
export function unmount() {
	throw new Error('unmount(...) is not available on the server');
}
 
export async function tick() {}
 
/**
 * @template T
 * @param {T} value
 * @returns {T}
 */
export function unstate(value) {
	// There's no signals/proxies on the server, so just return the value
	return value;
}
 
export { getAllContexts, getContext, hasContext, setContext } from './internal/server/context.js';