From ed39fbf168f7a30c4fbf5b5618b70146ce5d5b3e Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Sun, 27 Aug 2023 23:21:28 +0200 Subject: [PATCH] fix(deno): add start to options interface and extract to new file (close #8221) (#8245) * fix(deno): add start to options and extract to new file * Reword changeset --------- Co-authored-by: Arsh <69170106+lilnasy@users.noreply.github.com> --- .changeset/olive-moles-tan.md | 5 +++++ packages/integrations/deno/src/index.ts | 12 +----------- packages/integrations/deno/src/server.ts | 7 +------ packages/integrations/deno/src/types.ts | 11 +++++++++++ 4 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .changeset/olive-moles-tan.md create mode 100644 packages/integrations/deno/src/types.ts diff --git a/.changeset/olive-moles-tan.md b/.changeset/olive-moles-tan.md new file mode 100644 index 000000000000..9840fd4e3891 --- /dev/null +++ b/.changeset/olive-moles-tan.md @@ -0,0 +1,5 @@ +--- +'@astrojs/deno': patch +--- + +TypeScript users now get better suggestions when configuring the Deno adapter. diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index 3b011c83064a..d1dd6103dd52 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -3,17 +3,7 @@ import esbuild from 'esbuild'; import * as fs from 'node:fs'; import * as npath from 'node:path'; import { fileURLToPath } from 'node:url'; - -interface BuildConfig { - server: URL; - serverEntry: string; - assets: string; -} - -interface Options { - port?: number; - hostname?: string; -} +import type { BuildConfig, Options } from './types'; const SHIM = `globalThis.process = { argv: [], diff --git a/packages/integrations/deno/src/server.ts b/packages/integrations/deno/src/server.ts index 90a4a123795a..95c638b65d26 100644 --- a/packages/integrations/deno/src/server.ts +++ b/packages/integrations/deno/src/server.ts @@ -1,16 +1,11 @@ // Normal Imports import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; +import type { Options } from './types'; // @ts-expect-error import { fromFileUrl, serveFile, Server } from '@astrojs/deno/__deno_imports.js'; -interface Options { - port?: number; - hostname?: string; - start?: boolean; -} - let _server: Server | undefined = undefined; let _startPromise: Promise | undefined = undefined; diff --git a/packages/integrations/deno/src/types.ts b/packages/integrations/deno/src/types.ts new file mode 100644 index 000000000000..c44d0a842571 --- /dev/null +++ b/packages/integrations/deno/src/types.ts @@ -0,0 +1,11 @@ +export interface Options { + port?: number; + hostname?: string; + start?: boolean; +} + +export interface BuildConfig { + server: URL; + serverEntry: string; + assets: string; +}