summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar natemoo-re <natemoo-re@users.noreply.github.com> 2022-02-25 23:04:58 +0000
committerGravatar GitHub Actions <actions@github.com> 2022-02-25 23:04:58 +0000
commita5a15630944be615b6320424d8f7c7c23f5e11e7 (patch)
tree96483c574f8db4b87770f57bd2d4248160032b6c
parentfca6407318f7f189fb65f096f8166b85a322efda (diff)
downloadastro-a5a15630944be615b6320424d8f7c7c23f5e11e7.tar.gz
astro-a5a15630944be615b6320424d8f7c7c23f5e11e7.tar.zst
astro-a5a15630944be615b6320424d8f7c7c23f5e11e7.zip
[ci] yarn format
-rw-r--r--packages/astro/src/core/create-vite.ts16
-rw-r--r--packages/astro/src/vite-plugin-astro/compile.ts2
2 files changed, 6 insertions, 12 deletions
diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts
index b74d34345..af0c17631 100644
--- a/packages/astro/src/core/create-vite.ts
+++ b/packages/astro/src/core/create-vite.ts
@@ -44,7 +44,7 @@ interface CreateViteOptions {
export async function createVite(inlineConfig: ViteConfigWithSSR, { astroConfig, logging, mode }: CreateViteOptions): Promise<ViteConfigWithSSR> {
// Scan for any third-party Astro packages. Vite needs these to be passed to `ssr.noExternal`.
const astroPackages = await getAstroPackages(astroConfig);
-
+
// Start with the Vite configuration that Astro core needs
let viteConfig: ViteConfigWithSSR = {
cacheDir: fileURLToPath(new URL('./node_modules/.vite/', astroConfig.projectRoot)), // using local caches allows Astro to be used in monorepos, etc.
@@ -78,10 +78,7 @@ export async function createVite(inlineConfig: ViteConfigWithSSR, { astroConfig,
// Note: SSR API is in beta (https://vitejs.dev/guide/ssr.html)
ssr: {
external: [...ALWAYS_EXTERNAL],
- noExternal: [
- ...ALWAYS_NOEXTERNAL,
- ...astroPackages
- ],
+ noExternal: [...ALWAYS_NOEXTERNAL, ...astroPackages],
},
};
@@ -156,7 +153,7 @@ const COMMON_DEPENDENCIES_NOT_ASTRO = [
'astro',
'tslib',
'typescript',
- 'vite'
+ 'vite',
];
const COMMON_PREFIXES_NOT_ASTRO = [
@@ -174,17 +171,14 @@ const COMMON_PREFIXES_NOT_ASTRO = [
'remark-',
'rehype-',
'rollup-plugin-',
- 'vite-plugin-'
+ 'vite-plugin-',
];
function isCommonNotAstro(dep: string): boolean {
return (
COMMON_DEPENDENCIES_NOT_ASTRO.includes(dep) ||
COMMON_PREFIXES_NOT_ASTRO.some(
- (prefix) =>
- prefix.startsWith('@')
- ? dep.startsWith(prefix)
- : dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/
+ (prefix) => (prefix.startsWith('@') ? dep.startsWith(prefix) : dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix)) // check prefix omitting @scope/
)
);
}
diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts
index 569392ceb..1e83bf871 100644
--- a/packages/astro/src/vite-plugin-astro/compile.ts
+++ b/packages/astro/src/vite-plugin-astro/compile.ts
@@ -14,7 +14,7 @@ type CompileResult = TransformResult & { rawCSSDeps: Set<string> };
/**
* Note: this is currently needed because Astro is directly using a Vite internal CSS transform. This gives us
* some nice features out of the box, but at the expense of also running Vite's CSS postprocessing build step,
- * which does some things that we don't like, like resolving/handling `@import` too early. This function pulls
+ * which does some things that we don't like, like resolving/handling `@import` too early. This function pulls
* out the `@import` tags to be added back later, and then finally handled correctly by Vite.
*
* In the future, we should remove this workaround and most likely implement our own Astro style handling without