diff --git a/sites/svelte-5-preview/src/lib/CodeMirror.svelte b/sites/svelte-5-preview/src/lib/CodeMirror.svelte index 7e6d18ca83..ebeeef29dd 100644 --- a/sites/svelte-5-preview/src/lib/CodeMirror.svelte +++ b/sites/svelte-5-preview/src/lib/CodeMirror.svelte @@ -215,10 +215,7 @@ boost: 6 }), { label: '$effect.active', type: 'keyword', boost: 5 }, - { label: '$log', type: 'keyword', boost: 4 }, - { label: '$log.break', type: 'keyword', boost: 3 }, - { label: '$log.trace', type: 'keyword', boost: 2 }, - { label: '$log.table', type: 'keyword', boost: 1 } + { label: '$inspect', type: 'keyword', boost: 4 } ] }; } diff --git a/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md b/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md index 279273e79c..972996aa2a 100644 --- a/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md +++ b/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md @@ -241,87 +241,65 @@ let { a, b, c, ...everythingElse } = $props(); Note that you can still use `export const` and `export function` to expose things to users of your component (if they're using `bind:this`, for example). -## How to opt in - -Current Svelte code will continue to work without any adjustments. Components using the Svelte 4 syntax can use components using runes and vice versa. +## `$inspect` -The easiest way to opt in to runes mode is to just start using them in your code. Alternatively, you can force the compiler into runes or non-runes mode either on a per-component basis... - - -```svelte - - - -``` - -...or for your entire app: - -```js -/// file: svelte.config.js -export default { - compilerOptions: { - runes: true - } -}; -``` - -## `$log` - -The `$log` rune is roughly equivalent to `console.log`, with the exception that it will re-run whenever the -arguments change. `$log` tracks reactive state deeply, meaning that updating something inside an object -or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will update the logs. +The `$inspect` rune is roughly equivalent to `console.log`, with the exception that it will re-run whenever the +arguments change. `$inspect` tracks reactive state deeply, meaning that updating something inside an object +or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will cause it to re-fire. ```svelte + ``` -> `$log` only works during development. - -## `$log.break` - -This works just like `$log`, except runtime execution will be paused via a `debugger` statement. +If the last argument is a function, it will be invoked instead of `console.log`. The first argument is `changed` — +`false` when it initially runs, `true` thereafter — followed by the current values: ```svelte ``` -## `$log.table` - -This works just like `$log`, but triggers `console.table` instead of `console.log`. +> `$inspect` only works during development. -```svelte - - - -``` +## How to opt in -## `$log.trace` +Current Svelte code will continue to work without any adjustments. Components using the Svelte 4 syntax can use components using runes and vice versa. -This works just like `$log`, but in addition to logging the values themselves it will pinpoint the -line of code that triggered the update. +The easiest way to opt in to runes mode is to just start using them in your code. Alternatively, you can force the compiler into runes or non-runes mode either on a per-component basis... + ```svelte - +...or for your entire app: - +```js +/// file: svelte.config.js +export default { + compilerOptions: { + runes: true + } +}; ```