|
|
|
@ -121,9 +121,21 @@ export function validate_void_dynamic_element(tag: undefined | string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function validate_svelte_component(component: any) {
|
|
|
|
export function construct_svelte_component_dev(component, props) {
|
|
|
|
if (!(component.prototype instanceof SvelteComponent)) {
|
|
|
|
const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';
|
|
|
|
throw new Error('this={...} of <svelte:component> should specify a Svelte component.');
|
|
|
|
try {
|
|
|
|
|
|
|
|
const instance = new component(props);
|
|
|
|
|
|
|
|
if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {
|
|
|
|
|
|
|
|
throw new Error(error_message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
const { message } = err;
|
|
|
|
|
|
|
|
if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {
|
|
|
|
|
|
|
|
throw new Error(error_message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|