@whyframe/svelte

@whyframe/svelte exports a Vite plugin with the options below:

Options

include

  • Type: string | RegExp | (string | RegExp)[]
  • Default: /\.svelte$/

A picomatch pattern, or array of patterns, which specifies the files the plugin should operate on.

exclude

  • Type: string | RegExp | (string | RegExp)[]

A picomatch pattern, or array of patterns, which specifies the files to be ignored by the plugin.

preprocess

  • Type: boolean
  • Default: false

Whether to run whyframe’s Svelte transformation as a preprocessor. This is only required when using a markup preprocessor that changes the Svelte syntax, e.g. mdsvex.

Utilities

@whyframe/svelte/utils exports common utilities when using whyframe in a Svelte project.

import type { Warning } from 'svelte/types/compiler/interfaces'

/**
 * Whether the warning originates from `whyframe`'s internal processing.
 * This is usually used to suppress warnings in the `onwarn` function.
 *
 * @example
 * ```js
 * // svelte.config.js
 * import { isWhyframeWarning } from '@whyframe/svelte/utils'
 *
 * export default {
 *   onwarn(warning, handler) {
 *    if (isWhyframeWarning(warning)) return
 *    handler(warning)
 *   }
 * }
 * ```
 */
export declare function isWhyframeWarning(warning: Warning): boolean