diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 58548c0bb..45d3cad0e 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -62,12 +62,16 @@ export { _default as default };`; : '' } export const adapter = _adapter -${adapter.name !== '@astrojs/deno' ? ` +${ + adapter.name !== '@astrojs/deno' + ? ` const _start = 'start'; if(_start in _adapter) { _adapter[_start](_manifest, _args); -}`: ''}`; - } +}` + : '' +}`; + } return void 0; }, async generateBundle(_opts, bundle) { diff --git a/packages/integrations/deno/src/code-constant.ts b/packages/integrations/deno/src/code-constant.ts index bf272e397..c59ba30f9 100644 --- a/packages/integrations/deno/src/code-constant.ts +++ b/packages/integrations/deno/src/code-constant.ts @@ -1,2 +1,2 @@ -export const DEFAULTIMPORT = `import { Server } from "https://deno.land/std@0.167.0/http/server.ts"; \n import { fetch } from "https://deno.land/x/file_fetch/mod.ts";\nimport { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";` -export const DEFAULTSTART = `const _start = 'start'; \n if(_start in adapter) { \nadapter[_start](_manifest, _args);}` +export const DEFAULTIMPORT = `import { Server } from "https://deno.land/std@0.167.0/http/server.ts"; \n import { fetch } from "https://deno.land/x/file_fetch/mod.ts";\nimport { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";`; +export const DEFAULTSTART = `const _start = 'start'; \n if(_start in adapter) { \nadapter[_start](_manifest, _args);}`; diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index 891623ead..91f5fd836 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -3,7 +3,7 @@ import esbuild from 'esbuild'; import * as fs from 'fs'; import * as npath from 'path'; import { fileURLToPath } from 'url'; -import * as CONSTANT from './code-constant' +import * as CONSTANT from './code-constant'; interface BuildConfig { server: URL; @@ -71,7 +71,7 @@ export default function createIntegration(args?: Options): AstroIntegration { 'astro:build:done': async () => { const entryUrl = new URL(_buildConfig.serverEntry, _buildConfig.server); const pth = fileURLToPath(entryUrl); - const content = await fs.readFileSync(pth, 'utf8') + const content = await fs.readFileSync(pth, 'utf8'); await fs.writeFileSync(pth, `${CONSTANT.DEFAULTIMPORT}${content}${CONSTANT.DEFAULTSTART}`); await esbuild.build({ target: 'es2020', diff --git a/packages/integrations/deno/src/server.ts b/packages/integrations/deno/src/server.ts index ed358f2f0..94dce59ce 100644 --- a/packages/integrations/deno/src/server.ts +++ b/packages/integrations/deno/src/server.ts @@ -2,7 +2,6 @@ import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; - interface Options { port?: number; hostname?: string; @@ -49,7 +48,7 @@ export function start(manifest: SSRManifest, options: Options) { }` : stringLocalPath ); - + // If the static file can't be found if (fileResp.status == 404) { // Render the astro custom 404 page diff --git a/packages/integrations/deno/test/basics.test.ts b/packages/integrations/deno/test/basics.test.ts index e61dbd3f7..240a9bd4b 100644 --- a/packages/integrations/deno/test/basics.test.ts +++ b/packages/integrations/deno/test/basics.test.ts @@ -152,7 +152,6 @@ Deno.test({ const resp = await fetch(new URL('perendering', baseUrl)); assertEquals(resp.status, 200); - const html = await resp.text(); assert(html);