From 4bb96ac8e5890a9a4320b1d5655e691ebf7924cd Mon Sep 17 00:00:00 2001 From: FredKSchott Date: Tue, 19 Jul 2022 05:21:24 +0000 Subject: [PATCH] [ci] format --- examples/component/demo/astro.config.mjs | 2 +- packages/astro/src/core/build/static-build.ts | 8 +++++--- packages/astro/src/core/create-vite.ts | 19 ++++++++----------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/component/demo/astro.config.mjs b/examples/component/demo/astro.config.mjs index d92b7a872..2d73a2807 100644 --- a/examples/component/demo/astro.config.mjs +++ b/examples/component/demo/astro.config.mjs @@ -4,7 +4,7 @@ import { defineConfig } from 'astro/config'; export default defineConfig({ vite: { ssr: { - noExternal: ['@example/my-component'] + noExternal: ['@example/my-component'], }, }, }); diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 8680438f8..47670d038 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url'; import * as vite from 'vite'; import { BuildInternals, createBuildInternals } from '../../core/build/internal.js'; import { prependForwardSlash } from '../../core/path.js'; -import { emptyDir, removeDir, resolveDependency } from '../../core/util.js'; +import { emptyDir, removeDir } from '../../core/util.js'; import { runHookBuildSetup } from '../../integrations/index.js'; import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js'; import type { ViteConfigWithSSR } from '../create-vite'; @@ -67,7 +67,9 @@ export async function staticBuild(opts: StaticBuildOptions) { const ssrResult = (await ssrBuild(opts, internals, pageInput)) as RollupOutput; info(opts.logging, 'build', dim(`Completed in ${getTimeStat(timer.ssr, performance.now())}.`)); - const rendererClientEntrypoints = opts.astroConfig._ctx.renderers.map((r) => r.clientEntrypoint).filter(a => typeof a === 'string') as string[] + const rendererClientEntrypoints = opts.astroConfig._ctx.renderers + .map((r) => r.clientEntrypoint) + .filter((a) => typeof a === 'string') as string[]; const clientInput = new Set([ ...internals.discoveredHydratedComponents, @@ -169,7 +171,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp async function clientBuild( opts: StaticBuildOptions, internals: BuildInternals, - input: Set, + input: Set ) { const { astroConfig, viteConfig } = opts; const timer = performance.now(); diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 27badc1c7..6d0ceb7a5 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -35,17 +35,17 @@ const ALWAYS_NOEXTERNAL = new Set([ ]); function getSsrNoExternalDeps(projectRoot: URL): string[] { - let noExternalDeps = [] + let noExternalDeps = []; for (const dep of ALWAYS_NOEXTERNAL) { try { - resolveDependency(dep, projectRoot) - noExternalDeps.push(dep) + resolveDependency(dep, projectRoot); + noExternalDeps.push(dep); } catch { // ignore dependency if *not* installed / present in your project // prevents hard error from Vite! } } - return noExternalDeps + return noExternalDeps; } /** Return a common starting point for all Vite actions */ @@ -116,11 +116,8 @@ export async function createVite( conditions: ['astro'], }, ssr: { - noExternal: [ - ...getSsrNoExternalDeps(astroConfig.root), - ...thirdPartyAstroPackages, - ], - } + noExternal: [...getSsrNoExternalDeps(astroConfig.root), ...thirdPartyAstroPackages], + }, }; // Merge configs: we merge vite configuration objects together in the following order, @@ -147,8 +144,8 @@ function findPluginIndexByName(pluginOptions: vite.PluginOption[], name: string) return pluginOptions.findIndex(function (pluginOption) { // Use isVitePlugin to ignore nulls, booleans, promises, and arrays // CAUTION: could be a problem if a plugin we're searching for becomes async! - return isVitePlugin(pluginOption) && pluginOption.name === name - }) + return isVitePlugin(pluginOption) && pluginOption.name === name; + }); } function sortPlugins(pluginOptions: vite.PluginOption[]) {