Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adapter entrypoint typings to be NodeNext/ESNext-compatible. #5111

Merged
merged 3 commits into from
May 30, 2022
Merged
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
11 changes: 11 additions & 0 deletions .changeset/lemon-timers-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@sveltejs/adapter-auto": patch
"@sveltejs/adapter-cloudflare-workers": patch
"@sveltejs/adapter-cloudflare": patch
"@sveltejs/adapter-netlify": patch
"@sveltejs/adapter-node": patch
"@sveltejs/adapter-static": patch
"@sveltejs/adapter-vercel": patch
---

Update adapter entrypoint typings to be NodeNext/ESNext-compatible
3 changes: 1 addition & 2 deletions packages/adapter-auto/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Adapter } from '@sveltejs/kit';

declare function plugin(): Adapter;
export = plugin;
export default function plugin(): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-auto/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { adapters } from './adapters.js';

/** @type {import('./index')} */
/** @type {import('./index').default} */
let fn;

for (const candidate of adapters) {
3 changes: 1 addition & 2 deletions packages/adapter-cloudflare-workers/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Adapter } from '@sveltejs/kit';

declare function plugin(): Adapter;
export = plugin;
export default function plugin(): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import { fileURLToPath } from 'url';
* }} WranglerConfig
*/

/** @type {import('.')} */
/** @type {import('.').default} */
export default function (options = {}) {
return {
name: '@sveltejs/adapter-cloudflare-workers',
3 changes: 1 addition & 2 deletions packages/adapter-cloudflare/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Adapter } from '@sveltejs/kit';

declare function plugin(): Adapter;
export = plugin;
export default function plugin(): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/index.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { posix } from 'path';
import { fileURLToPath } from 'url';
import * as esbuild from 'esbuild';

/** @type {import('.')} */
/** @type {import('.').default} */
export default function (options = {}) {
return {
name: '@sveltejs/adapter-cloudflare',
4 changes: 1 addition & 3 deletions packages/adapter-netlify/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Adapter } from '@sveltejs/kit';

declare function plugin(opts?: { split?: boolean; edge?: boolean }): Adapter;

export = plugin;
export default function plugin(opts?: { split?: boolean; edge?: boolean }): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-netlify/index.js
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ const edge_set_in_env_var =
process.env.NETLIFY_SVELTEKIT_USE_EDGE === 'true' ||
process.env.NETLIFY_SVELTEKIT_USE_EDGE === '1';

/** @type {import('.')} */
/** @type {import('.').default} */
export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
return {
name: '@sveltejs/adapter-netlify',
3 changes: 1 addition & 2 deletions packages/adapter-node/index.d.ts
Original file line number Diff line number Diff line change
@@ -10,5 +10,4 @@ interface AdapterOptions {
envPrefix?: string;
}

declare function plugin(options?: AdapterOptions): Adapter;
export = plugin;
export default function plugin(options?: AdapterOptions): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ const pipe = promisify(pipeline);

const files = fileURLToPath(new URL('./files', import.meta.url).href);

/** @type {import('.')} */
/** @type {import('.').default} */
export default function (opts = {}) {
// TODO remove for 1.0
// @ts-expect-error
3 changes: 1 addition & 2 deletions packages/adapter-static/index.d.ts
Original file line number Diff line number Diff line change
@@ -7,5 +7,4 @@ interface AdapterOptions {
precompress?: boolean;
}

declare function plugin(options?: AdapterOptions): Adapter;
export = plugin;
export default function plugin(options?: AdapterOptions): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-static/index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import zlib from 'zlib';

const pipe = promisify(pipeline);

/** @type {import('.')} */
/** @type {import('.').default} */
export default function ({ pages = 'build', assets = pages, fallback, precompress = false } = {}) {
return {
name: '@sveltejs/adapter-static',
3 changes: 1 addition & 2 deletions packages/adapter-vercel/index.d.ts
Original file line number Diff line number Diff line change
@@ -6,5 +6,4 @@ type Options = {
split?: boolean;
};

declare function plugin(options?: Options): Adapter;
export = plugin;
export default function plugin(options?: Options): Adapter;
2 changes: 1 addition & 1 deletion packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ const redirects = {

const files = fileURLToPath(new URL('./files', import.meta.url).href);

/** @type {import('.')} **/
/** @type {import('.').default} **/
export default function ({ external = [], edge, split } = {}) {
return {
name: '@sveltejs/adapter-vercel',