mirror of https://github.com/sveltejs/svelte
				
				
				
			
						commit
						c0a218b69e
					
				@ -0,0 +1,15 @@
 | 
				
			||||
import * as acorn from 'acorn';
 | 
				
			||||
import dynamicImport from 'acorn-dynamic-import';
 | 
				
			||||
 | 
				
			||||
const Parser = acorn.Parser.extend(dynamicImport);
 | 
				
			||||
 | 
				
			||||
export const parse = (source: string, options: any) => Parser.parse(source, {
 | 
				
			||||
	sourceType: 'module',
 | 
				
			||||
	ecmaVersion: 9,
 | 
				
			||||
	preserveParens: true
 | 
				
			||||
});
 | 
				
			||||
 | 
				
			||||
export const parseExpressionAt = (source: string, index: number, options: any) => Parser.parseExpressionAt(source, index, {
 | 
				
			||||
	ecmaVersion: 9,
 | 
				
			||||
	preserveParens: true
 | 
				
			||||
});
 | 
				
			||||
@ -0,0 +1,11 @@
 | 
				
			||||
export default {
 | 
				
			||||
	preserveIdentifiers: true,
 | 
				
			||||
 | 
				
			||||
	props: {
 | 
				
			||||
		click_handler: 'x'
 | 
				
			||||
	},
 | 
				
			||||
 | 
				
			||||
	html: `
 | 
				
			||||
		<button>x</button>
 | 
				
			||||
	`
 | 
				
			||||
};
 | 
				
			||||
@ -0,0 +1 @@
 | 
				
			||||
<button on:click="{() => foo()}">{click_handler}</button>
 | 
				
			||||
@ -0,0 +1 @@
 | 
				
			||||
<h1>Hello {user.name}!</h1>
 | 
				
			||||
@ -0,0 +1,9 @@
 | 
				
			||||
export default {
 | 
				
			||||
	props: {
 | 
				
			||||
		currentUser: { name: 'world' }
 | 
				
			||||
	},
 | 
				
			||||
 | 
				
			||||
	html: `
 | 
				
			||||
		<h1>Hello world!</h1>
 | 
				
			||||
	`
 | 
				
			||||
};
 | 
				
			||||
@ -0,0 +1,6 @@
 | 
				
			||||
<script>
 | 
				
			||||
	import Nested from './Nested.html';
 | 
				
			||||
	export let currentUser;
 | 
				
			||||
</script>
 | 
				
			||||
 | 
				
			||||
<Nested user={currentUser}/>
 | 
				
			||||
@ -0,0 +1,3 @@
 | 
				
			||||
export default {
 | 
				
			||||
	html: '<button>Click</button>'
 | 
				
			||||
};
 | 
				
			||||
@ -0,0 +1,2 @@
 | 
				
			||||
<svelte:window bind:innerWidth={width} bind:innerHeight={height}/>
 | 
				
			||||
<button on:click={() => {}}>Click</button>
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue