Skip to content

Tidy up adapter API #166

Closed
Closed
@Rich-Harris

Description

As noted here, the adapter API needs a bit of an overhaul. A lot of arguments need to get carted around so that they can be passed to render(...) and prerender(...), and it would be somewhat simpler if they were included in a manifest-type object that contained all the information SvelteKit had about the app — routes, the template, whether we're in dev mode, any options that needed to be passed from svelte.config.js (like target), CSS and JS dependencies for each route, and potentially other stuff (a list of files in static, etc).

This also gives us a lot more flexibility (for example, the src/app.html file is currently hardcoded in each adapter, which prevents things like #160).

It needn't be a simple object, either (manifest currently is a POJO but isn't directly serializable since it contains regexes) — it could be an instance of a class that has methods for stuff adapters need in common (like dumping assets and static files somwehere, prerendering pages (which is something app-utils probably doesn't need to offer at runtime), generating the route manifest modules needed by cloud functions at runtime, etc etc.

In short, a complete rethink is in order.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions