Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored and astrobot-houston committed Jul 19, 2022
1 parent 04070c0 commit 4bb96ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/component/demo/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from 'astro/config';
export default defineConfig({
vite: {
ssr: {
noExternal: ['@example/my-component']
noExternal: ['@example/my-component'],
},
},
});
8 changes: 5 additions & 3 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -169,7 +171,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
async function clientBuild(
opts: StaticBuildOptions,
internals: BuildInternals,
input: Set<string>,
input: Set<string>
) {
const { astroConfig, viteConfig } = opts;
const timer = performance.now();
Expand Down
19 changes: 8 additions & 11 deletions packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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,
Expand All @@ -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[]) {
Expand Down

0 comments on commit 4bb96ac

Please sign in to comment.