@@ -4,7 +4,13 @@ import { tick } from 'svelte'
44const containerCache = new Map ( )
55const componentCache = new Set ( )
66
7- const svleteComponentOptions = [ 'anchor' , 'props' , 'hydrate' , 'intro' ]
7+ const svelteComponentOptions = [
8+ 'anchor' ,
9+ 'props' ,
10+ 'hydrate' ,
11+ 'intro' ,
12+ 'context'
13+ ]
814
915const render = (
1016 Component ,
@@ -17,19 +23,21 @@ const render = (
1723 const ComponentConstructor = Component . default || Component
1824
1925 const checkProps = ( options ) => {
20- const isProps = ! Object . keys ( options ) . some ( option => svleteComponentOptions . includes ( option ) )
26+ const isProps = ! Object . keys ( options ) . some ( ( option ) =>
27+ svelteComponentOptions . includes ( option )
28+ )
2129
2230 // Check if any props and Svelte options were accidentally mixed.
2331 if ( ! isProps ) {
24- const unrecognizedOptions = Object
25- . keys ( options )
26- . filter ( option => ! svleteComponentOptions . includes ( option ) )
32+ const unrecognizedOptions = Object . keys ( options ) . filter (
33+ ( option ) => ! svelteComponentOptions . includes ( option )
34+ )
2735
2836 if ( unrecognizedOptions . length > 0 ) {
2937 throw Error ( `
30- Unknown options were found [${ unrecognizedOptions } ]. This might happen if you've mixed
31- passing in props with Svelte options into the render function. Valid Svelte options
32- are [${ svleteComponentOptions } ]. You can either change the prop names, or pass in your
38+ Unknown options were found [${ unrecognizedOptions } ]. This might happen if you've mixed
39+ passing in props with Svelte options into the render function. Valid Svelte options
40+ are [${ svelteComponentOptions } ]. You can either change the prop names, or pass in your
3341 props for that component via the \`props\` option.\n\n
3442 Eg: const { /** Results **/ } = render(MyComponent, { props: { /** props here **/ } })\n\n
3543 ` )
@@ -76,7 +84,7 @@ const render = (
7684 }
7785}
7886
79- const cleanupAtContainer = container => {
87+ const cleanupAtContainer = ( container ) => {
8088 const { target, component } = containerCache . get ( container )
8189
8290 if ( componentCache . has ( component ) ) component . $destroy ( )
0 commit comments