diff options
author | 2023-02-17 18:21:11 +0000 | |
---|---|---|
committer | 2023-02-17 18:21:11 +0000 | |
commit | ff70614083d60758daac2c7d8f7c83601b474291 (patch) | |
tree | 8d08a8c6c078a740649fa039dc5199add8c4daae | |
parent | 61113dd731f2db39ebecb8f2f473823b56d3160b (diff) | |
download | astro-ff70614083d60758daac2c7d8f7c83601b474291.tar.gz astro-ff70614083d60758daac2c7d8f7c83601b474291.tar.zst astro-ff70614083d60758daac2c7d8f7c83601b474291.zip |
[ci] format
-rw-r--r-- | packages/integrations/deno/src/__deno_imports.ts | 2 | ||||
-rw-r--r-- | packages/integrations/deno/src/index.ts | 37 | ||||
-rw-r--r-- | packages/integrations/deno/src/server.ts | 7 | ||||
-rw-r--r-- | packages/integrations/deno/test/basics.test.ts | 1 |
4 files changed, 23 insertions, 24 deletions
diff --git a/packages/integrations/deno/src/__deno_imports.ts b/packages/integrations/deno/src/__deno_imports.ts index 2775f1a5b..710cd69f6 100644 --- a/packages/integrations/deno/src/__deno_imports.ts +++ b/packages/integrations/deno/src/__deno_imports.ts @@ -1,6 +1,6 @@ // This file is a shim for any Deno-specific imports! // It will be replaced in the final Deno build. -// +// // This allows us to prerender pages in Node. export class Server { listenAndServe() {} diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index fcfda5dc3..dc3070d53 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -20,15 +20,15 @@ const SHIM = `globalThis.process = { env: Deno.env.toObject(), };`; -const DENO_VERSION = `0.177.0` +const DENO_VERSION = `0.177.0`; // We shim deno-specific imports so we can run the code in Node -// to prerender pages. In the final Deno build, this import is +// to prerender pages. In the final Deno build, this import is // replaced with the Deno-specific contents listed below. const DENO_IMPORTS_SHIM = `@astrojs/deno/__deno_imports.js`; const DENO_IMPORTS = `export { Server } from "https://deno.land/std@${DENO_VERSION}/http/server.ts" export { serveFile } from 'https://deno.land/std@${DENO_VERSION}/http/file_server.ts'; -export { fromFileUrl } from "https://deno.land/std@${DENO_VERSION}/path/mod.ts";` +export { fromFileUrl } from "https://deno.land/std@${DENO_VERSION}/path/mod.ts";`; export function getAdapter(args?: Options): AstroAdapter { return { @@ -40,16 +40,16 @@ export function getAdapter(args?: Options): AstroAdapter { } const denoImportsShimPlugin = { - name: '@astrojs/deno:shim', - setup(build: esbuild.PluginBuild) { - build.onLoad({ filter: /__deno_imports\.js$/ }, async (args) => { - return { - contents: DENO_IMPORTS, - loader: 'js', - } - }) - }, -} + name: '@astrojs/deno:shim', + setup(build: esbuild.PluginBuild) { + build.onLoad({ filter: /__deno_imports\.js$/ }, async (args) => { + return { + contents: DENO_IMPORTS, + loader: 'js', + }; + }); + }, +}; export default function createIntegration(args?: Options): AstroIntegration { let _buildConfig: BuildConfig; @@ -91,9 +91,12 @@ export default function createIntegration(args?: Options): AstroIntegration { }; if (Array.isArray(vite.build.rollupOptions.external)) { - vite.build.rollupOptions.external.push(DENO_IMPORTS_SHIM); + vite.build.rollupOptions.external.push(DENO_IMPORTS_SHIM); } else if (typeof vite.build.rollupOptions.external !== 'function') { - vite.build.rollupOptions.external = [vite.build.rollupOptions.external, DENO_IMPORTS_SHIM] + vite.build.rollupOptions.external = [ + vite.build.rollupOptions.external, + DENO_IMPORTS_SHIM, + ]; } } }, @@ -110,9 +113,7 @@ export default function createIntegration(args?: Options): AstroIntegration { format: 'esm', bundle: true, external: ['@astrojs/markdown-remark'], - plugins: [ - denoImportsShimPlugin - ], + plugins: [denoImportsShimPlugin], banner: { js: SHIM, }, diff --git a/packages/integrations/deno/src/server.ts b/packages/integrations/deno/src/server.ts index 8979a96d0..8d3e074f5 100644 --- a/packages/integrations/deno/src/server.ts +++ b/packages/integrations/deno/src/server.ts @@ -3,7 +3,7 @@ import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; // @ts-ignore -import { Server, serveFile, fromFileUrl } from '@astrojs/deno/__deno_imports.js'; +import { fromFileUrl, serveFile, Server } from '@astrojs/deno/__deno_imports.js'; interface Options { port?: number; @@ -18,9 +18,9 @@ async function* getPrerenderedFiles(clientRoot: URL): AsyncGenerator<URL> { // @ts-ignore for await (const ent of Deno.readDir(clientRoot)) { if (ent.isDirectory) { - yield* getPrerenderedFiles(new URL(`./${ent.name}/`, clientRoot)) + yield* getPrerenderedFiles(new URL(`./${ent.name}/`, clientRoot)); } else if (ent.name.endsWith('.html')) { - yield new URL(`./${ent.name}`, clientRoot) + yield new URL(`./${ent.name}`, clientRoot); } } } @@ -67,7 +67,6 @@ export function start(manifest: SSRManifest, options: Options) { } } - // 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 ea81042b2..48a35d785 100644 --- a/packages/integrations/deno/test/basics.test.ts +++ b/packages/integrations/deno/test/basics.test.ts @@ -144,7 +144,6 @@ Deno.test({ sanitizeOps: false, }); - Deno.test({ name: 'perendering', permissions: defaultTestPermissions, |