From 84f77fea107c2dc4637e045832d61396562c0ac8 Mon Sep 17 00:00:00 2001
From: Ben McCann <322311+benmccann@users.noreply.github.com>
Date: Sat, 19 Feb 2022 20:37:40 -0800
Subject: [PATCH] Ensure public types don't reference internal types
---
packages/kit/types/index.d.ts | 106 +++++++++++++++++++++---------
packages/kit/types/internal.d.ts | 108 ++++++++-----------------------
2 files changed, 104 insertions(+), 110 deletions(-)
diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts
index 5f1b7ac72028..b8d873250358 100644
--- a/packages/kit/types/index.d.ts
+++ b/packages/kit/types/index.d.ts
@@ -2,22 +2,6 @@
///
import { CompileOptions } from 'svelte/types/compiler/interfaces';
-import {
- Logger,
- PrerenderOnErrorValue,
- SSRNodeLoader,
- SSRRoute,
- TrailingSlash,
- Either,
- MaybePromise,
- RecursiveRequired,
- RouteDefinition,
- AdapterEntry,
- ResponseHeaders,
- Fallthrough,
- RequiredResolveOptions,
- Body
-} from './internal';
import './ambient';
export class App {
@@ -34,6 +18,32 @@ export interface Adapter {
adapt(builder: Builder): Promise;
}
+export interface AdapterEntry {
+ /**
+ * A string that uniquely identifies an HTTP service (e.g. serverless function) and is used for deduplication.
+ * For example, `/foo/a-[b]` and `/foo/[c]` are different routes, but would both
+ * be represented in a Netlify _redirects file as `/foo/:param`, so they share an ID
+ */
+ id: string;
+
+ /**
+ * A function that compares the candidate route with the current route to determine
+ * if it should be treated as a fallback for the current route. For example, `/foo/[c]`
+ * is a fallback for `/foo/a-[b]`, and `/[...catchall]` is a fallback for all routes
+ */
+ filter: (route: RouteDefinition) => boolean;
+
+ /**
+ * A function that is invoked once the entry has been created. This is where you
+ * should write the function to the filesystem and generate redirect manifests.
+ */
+ complete: (entry: {
+ generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
+ }) => void;
+}
+
+export type Body = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
+
export interface Builder {
log: Logger;
rimraf(dir: string): void;
@@ -269,6 +279,8 @@ export type CspDirectives = {
>;
};
+export type Either = Only | Only;
+
export interface EndpointOutput