Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mean-horses-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: extend `vite-plugin-svelte`'s `Config` type instead of duplicating it
24 changes: 8 additions & 16 deletions packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'svelte'; // pick up `declare module "*.svelte"`
import 'vite/client'; // pick up `declare module "*.jpg"`, etc.
import '../types/ambient.js';

import { CompileOptions } from 'svelte/compiler';
import {
AdapterEntry,
CspDirectives,
Expand All @@ -18,7 +17,7 @@ import {
RouteSegment
} from '../types/private.js';
import { BuildData, SSRNodeLoader, SSRRoute, ValidatedConfig } from 'types';
import type { PluginOptions } from '@sveltejs/vite-plugin-svelte';
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';

export { PrerenderOption } from '../types/private.js';

Expand Down Expand Up @@ -188,23 +187,16 @@ export interface Builder {
compress: (directory: string) => Promise<void>;
}

export interface Config {
/**
* Options passed to [`svelte.compile`](https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions).
* @default {}
*/
compilerOptions?: CompileOptions;
/**
* An extension of [`vite-plugin-svelte`'s options](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#svelte-options).
*/
export interface Config extends SvelteConfig {
/**
* List of file extensions that should be treated as Svelte files.
* @default [".svelte"]
* SvelteKit options.
*
* @see https://svelte.dev/docs/kit/configuration
*/
extensions?: string[];
/** SvelteKit options */
kit?: KitConfig;
/** Preprocessor options, if any. Preprocessing can alternatively also be done through Vite's preprocessor capabilities. */
preprocess?: any;
/** `vite-plugin-svelte` plugin options. */
vitePlugin?: PluginOptions;
/** Any additional options required by tooling that integrates with Svelte. */
[key: string]: any;
}
Expand Down
24 changes: 8 additions & 16 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/// <reference types="vite/client" />

declare module '@sveltejs/kit' {
import type { CompileOptions } from 'svelte/compiler';
import type { PluginOptions } from '@sveltejs/vite-plugin-svelte';
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
/**
* [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing.
*/
Expand Down Expand Up @@ -170,23 +169,16 @@ declare module '@sveltejs/kit' {
compress: (directory: string) => Promise<void>;
}

export interface Config {
/**
* Options passed to [`svelte.compile`](https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions).
* @default {}
*/
compilerOptions?: CompileOptions;
/**
* An extension of [`vite-plugin-svelte`'s options](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#svelte-options).
*/
export interface Config extends SvelteConfig {
/**
* List of file extensions that should be treated as Svelte files.
* @default [".svelte"]
* SvelteKit options.
*
* @see https://svelte.dev/docs/kit/configuration
*/
extensions?: string[];
/** SvelteKit options */
kit?: KitConfig;
/** Preprocessor options, if any. Preprocessing can alternatively also be done through Vite's preprocessor capabilities. */
preprocess?: any;
/** `vite-plugin-svelte` plugin options. */
vitePlugin?: PluginOptions;
/** Any additional options required by tooling that integrates with Svelte. */
[key: string]: any;
}
Expand Down
Loading