docs: normalize svelte compiler headings (#8755)

The `svelte.` prefix was a remnant of CJS times
pull/8762/head
Puru Vijay 1 year ago committed by GitHub
parent be7a266e4a
commit 67b4e4ff1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,7 +38,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a _property_
You can specify a default initial value for a prop. It will be used if the component's consumer doesn't specify the prop on the component (or if its initial value is `undefined`) when instantiating the component. Note that if the values of props are subsequently updated, then any prop whose value is not specified will be set to `undefined` (rather than its initial value).
In development mode (see the [compiler options](/docs/svelte-compiler#svelte-compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
In development mode (see the [compiler options](/docs/svelte-compiler#compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
```svelte
<script>

@ -313,7 +313,7 @@ As with `<svelte:window>`, `<svelte:document>` and `<svelte:body>`, this element
<svelte:options option={value} />
```
The `<svelte:options>` element provides a place to specify per-component compiler options, which are detailed in the [compiler section](/docs/svelte-compiler#svelte-compile). The possible options are:
The `<svelte:options>` element provides a place to specify per-component compiler options, which are detailed in the [compiler section](/docs/svelte-compiler#compile). The possible options are:
- `immutable={true}` — you never use mutable data, so the compiler can do simple referential equality checks to determine if values have changed
- `immutable={false}` — the default. Svelte will be more conservative about whether or not mutable objects have changed

@ -6,7 +6,7 @@ Typically, you won't interact with the Svelte compiler directly, but will instea
Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you.
## `svelte.compile`
## compile
> EXPORT_SNIPPET: svelte/compiler#compile
@ -154,7 +154,7 @@ compiled: {
-->
## `svelte.parse`
## parse
> EXPORT_SNIPPET: svelte/compiler#parse
@ -175,7 +175,7 @@ import { parse } from 'svelte/compiler';
const ast = parse(source, { filename: 'App.svelte' });
```
## `svelte.preprocess`
## preprocess
> EXPORT_SNIPPET: svelte/compiler#preprocess
@ -353,7 +353,7 @@ const { code } = await preprocess(source, [
});
```
## `svelte.walk`
## walk
> EXPORT_SNIPPET: svelte/compiler#walk
@ -390,7 +390,7 @@ walk(ast, {
});
```
## `svelte.VERSION`
## VERSION
> EXPORT_SNIPPET: svelte/compiler#VERSION

@ -60,7 +60,7 @@ The following initialisation options can be provided:
Existing children of `target` are left where they are.
The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](/docs/svelte-compiler#svelte-compile). Hydration of `<head>` elements only works properly if the server-side rendering code was also compiled with `hydratable: true`, which adds a marker to each element in the `<head>` so that the component knows which elements it's responsible for removing during hydration.
The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](/docs/svelte-compiler#compile). Hydration of `<head>` elements only works properly if the server-side rendering code was also compiled with `hydratable: true`, which adds a marker to each element in the `<head>` so that the component knows which elements it's responsible for removing during hydration.
Whereas children of `target` are normally left alone, `hydrate: true` will cause any children to be removed. For that reason, the `anchor` option cannot be used alongside `hydrate: true`.

@ -168,7 +168,7 @@
[/run-time-(svelte)(?:-(.+))?/i, '$1#$2'],
// Compile time
[/compile-time-?(.*)/i, 'svelte-compiler#$1'],
[/compile-time-svelte-?(.*)/i, 'svelte-compiler#$1'],
// Accessibility warnings
[/(accessibility-warnings)-?(.+)/i, '$1#$2']

Loading…
Cancel
Save