CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-sveltejs--adapter-auto

SvelteKit adapter that automatically detects deployment environment and installs appropriate platform-specific adapter

Overall
score

96%

Overview
Eval results
Files

task.mdevals/scenario-10/

SvelteKit Plugin Type Guard

A TypeScript utility that validates SvelteKit adapter configurations at compile-time and runtime.

Overview

Create a type-safe validation utility for SvelteKit adapter configurations. The utility should leverage TypeScript type definitions to ensure adapters conform to the expected interface before being used in a SvelteKit project.

Capabilities

Type-safe adapter validation

  • Given an adapter object with name "test-adapter", adapt method, and supports object, isValidAdapter returns true @test
  • Given an object missing the adapt method, isValidAdapter returns false @test

Feature support checking

  • Given an adapter with a supports object, supportsFeature correctly checks if a feature is supported @test

Implementation

@generates

API

import type { Adapter } from '@sveltejs/kit';

/**
 * Validates whether an object conforms to the SvelteKit Adapter interface.
 *
 * @param adapter - The adapter object to validate
 * @returns true if the adapter has all required properties with correct types
 */
export function isValidAdapter(adapter: unknown): adapter is Adapter;

/**
 * Type guard that checks if an adapter supports a specific feature.
 *
 * @param adapter - The adapter to check
 * @param feature - The feature name to check support for
 * @returns true if the adapter supports the feature
 */
export function supportsFeature(adapter: Adapter, feature: string): boolean;

Dependencies { .dependencies }

@sveltejs/kit { .dependency }

Provides TypeScript type definitions for SvelteKit adapters.

Install with Tessl CLI

npx tessl i tessl/npm-sveltejs--adapter-auto

tile.json