From 43a9d64c3e18fea7e666fc115db76332a27c8eaa Mon Sep 17 00:00:00 2001 From: Conduitry Date: Tue, 19 Mar 2019 04:09:59 -0400 Subject: [PATCH] update readme --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a6af821f3b..1db6e8923e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ This is the Svelte compiler, which is primarily intended for authors of tooling ```js import * as svelte from 'svelte/compiler'; -const { js, css, ast } = svelte.compile(source, { +const { js, css } = svelte.compile(source, { // the target module format – defaults to 'esm' (ES2015 modules), can also be 'cjs' format: 'cjs', @@ -52,7 +52,6 @@ const { js, css, ast } = svelte.compile(source, { }); ``` - ## API The Svelte compiler exposes the following API: @@ -83,18 +82,24 @@ The Svelte compiler optionally takes a second argument, an object of configurati |---|---|---|---| | `generate` | `'dom'`, `'ssr'`, `false` | Whether to generate JavaScript code intended for use on the client (`'dom'`), or for use in server-side rendering (`'ssr'`). If `false`, component will be parsed and validated but no code will be emitted. | `'dom'` | | `dev` | `boolean` | Whether to enable run-time checks in the compiled component. These are helpful during development, but slow your component down. | `false` | +| `customElement` | `boolean` | Whether to compile this component to a custom element. | `false` | +| `tag` | `string` | Overrides any `` value specified by the component. | `null` | +| | | | | `css` | `boolean` | Whether to include JavaScript code to inject your component's styles into the DOM. | `true` | +| `accessors` | `boolean` | Whether to include getters and setters for all props on the compiled component. This only affects components without ``, which has higher precedence than this option. | `false` | | `hydratable` | `boolean` | Whether to support hydration on the compiled component. | `false` | | `immutable` | `boolean` | Whether to use object comparisons that assume immutability. This only affects components without ``, which has higher precedence than this option. | `false` | -| `customElement` | `boolean`, `{ tag, props }` | Whether to compile this component to a custom element. If `tag`/`props` are passed, compiles to a custom element and overrides the values exported by the component. | `false` | -| `bind` | `boolean` | If `false`, disallows `bind:` directives. | `true` | | `legacy` | `boolean` | Ensures compatibility with very old browsers, at the cost of some extra code. | `false` | | | | | +| `preserveWhitespace` | `boolean` | TODO | `false` | +| `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering. | `false` | +| | | | | `format` | `'esm'`, `'cjs'` | The format to output in the compiled component.
`'esm'` - ES6/ES2015 module, suitable for consumption by a bundler
`'cjs'` - CommonJS module | `'esm'` | | `name` | `string` | The name of the constructor in the compiled component. | `'SvelteComponent'` | | `filename` | `string` | The filename to use in sourcemaps and compiler error and warning messages. | `'SvelteComponent.html'` | +| `outputFilename` | `string` | TODO | TODO | +| `cssOutputFilename` | `string` | TODO | TODO | | `sveltePath` | `string` | The path to the root of the package used in `import`s generated by the compiler. | `'svelte'` | -| `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering. | `false` | ### Preprocessor options