function parse(source, { filename, rootDir, modern, loose } = {}) {
	source = remove_bom(source);
	state.reset_warning_filter(() => false);
	state.reset(source, { filename: filename ?? '(unknown)', rootDir });

	const ast = _parse(source, loose);
	return to_public_ast(source, ast, modern);
}
The parse function parses a component, returning only its abstract syntax tree.

The `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.
`modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7.

The `loose` option, available since 5.13.0, tries to always return an AST even if the input will not successfully compile.

@param {string} source
@param {{ filename?: string; rootDir?: string; modern?: boolean; loose?: boolean }} [options]
@returns {AST.Root | LegacyRoot}