From 5e6801c1104688f35b09a73de955b59a32ebd20e Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 18 Feb 2019 16:38:26 -0500 Subject: [PATCH] update compiler output structure in readme --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4648a50466..5eb406c64f 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,21 @@ const { js, css, ast } = svelte.compile(source, { The Svelte compiler exposes the following API: -* `compile(source [, options]) => { js, css, ast, stats }` - Compile the component with the given options (see below). Returns an object containing the compiled JavaScript, the transformed CSS, the AST and other information about the component. +* `compile(source [, options]) => { ... }` - Compile the component with the given options (see below). Returns an object, containing: + * `js` - the compiled JavaScript, containing: + * `code` - a string + * `map` - the sourcemap + * `css` - the transformed CSS, containing: + * `code` - a string + * `map` - the sourcemap + * `ast` - ASTs for the input component, containing: + * `html` - the template + * `css` - the styles + * `instance` - the per-instance JavaScript code + * `module` - the one-time (module-level) JavaScript code + * `warnings` - an array of compiler warnings + * `vars` - an array of referenced variables + * `stats` - other diagnostic information * `preprocess(source, options) => Promise` — Preprocess a source file, e.g. to use PostCSS or CoffeeScript * `VERSION` - The version of this copy of the Svelte compiler as a string, `'x.x.x'`.