aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar FredKSchott <FredKSchott@users.noreply.github.com> 2022-07-19 05:21:24 +0000
committerGravatar fredkbot <fred+astrobot@astro.build> 2022-07-19 05:21:24 +0000
commit4bb96ac8e5890a9a4320b1d5655e691ebf7924cd (patch)
treee8635ade969d5c9788433579b80a3f6c1dea60d5
parent04070c0c12c00a3e17842ce48e36edc3f2c890a3 (diff)
downloadastro-4bb96ac8e5890a9a4320b1d5655e691ebf7924cd.tar.gz
astro-4bb96ac8e5890a9a4320b1d5655e691ebf7924cd.tar.zst
astro-4bb96ac8e5890a9a4320b1d5655e691ebf7924cd.zip
[ci] format
-rw-r--r--examples/component/demo/astro.config.mjs2
-rw-r--r--packages/astro/src/core/build/static-build.ts8
-rw-r--r--packages/astro/src/core/create-vite.ts19
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<string>,
+ input: Set<string>
) {
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[]) {