@ -11,8 +11,10 @@ import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
import { create _fragment _from _html } from '../reconciler.js' ;
import { assign _nodes } from '../template.js' ;
import * as w from '../../warnings.js' ;
import * as e from '../../errors.js' ;
import { DEV } from 'esm-env' ;
import { get _first _child , get _next _sibling } from '../operations.js' ;
import { noop } from '../../../shared/utils.js' ;
/ * *
* @ template { ( node : TemplateNode , ... args : any [ ] ) => void } SnippetFn
@ -25,7 +27,8 @@ export function snippet(node, get_snippet, ...args) {
var anchor = node ;
/** @type {SnippetFn | null | undefined} */
var snippet = /** @type {SnippetFn} */ ( empty _snippet ) ;
// @ts-ignore
var snippet = noop ;
/** @type {Effect | null} */
var snippet _effect ;
@ -38,6 +41,10 @@ export function snippet(node, get_snippet, ...args) {
snippet _effect = null ;
}
if ( DEV && snippet == null ) {
e . invalid _snippet ( ) ;
}
snippet _effect = branch ( ( ) => /** @type {SnippetFn} */ ( snippet ) ( anchor , ... args ) ) ;
} , EFFECT _TRANSPARENT ) ;
@ -46,10 +53,6 @@ export function snippet(node, get_snippet, ...args) {
}
}
// Just an empty function
/** @type {(...args: any[]) => void} */
export const empty _snippet = ( ) => { } ;
/ * *
* In development , wrap the snippet function so that it passes validation , and so that the
* correct component context is set for ownership checks