You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/compiler/index.js

24 lines
639 B

8 years ago
import parse from './parse/index.js';
8 years ago
import validate from './validate/index.js';
8 years ago
import generate from './generate/index.js';
8 years ago
export function compile ( source, options = {} ) {
const parsed = parse( source, options );
8 years ago
8 years ago
if ( !options.onwarn ) {
options.onwarn = warning => {
if ( warning.loc ) {
console.warn( `(${warning.loc.line}:${warning.loc.column}) ${warning.message}` ); // eslint-disable-line no-console
} else {
console.warn( warning.message ); // eslint-disable-line no-console
}
8 years ago
};
8 years ago
}
8 years ago
validate( parsed, source, options );
8 years ago
return generate( parsed, source, options );
8 years ago
}
8 years ago
8 years ago
export { parse, validate };