[ci] yarn format
This commit is contained in:
parent
fca6407318
commit
a5a1563094
2 changed files with 6 additions and 12 deletions
|
@ -44,7 +44,7 @@ interface CreateViteOptions {
|
||||||
export async function createVite(inlineConfig: ViteConfigWithSSR, { astroConfig, logging, mode }: CreateViteOptions): Promise<ViteConfigWithSSR> {
|
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`.
|
// Scan for any third-party Astro packages. Vite needs these to be passed to `ssr.noExternal`.
|
||||||
const astroPackages = await getAstroPackages(astroConfig);
|
const astroPackages = await getAstroPackages(astroConfig);
|
||||||
|
|
||||||
// Start with the Vite configuration that Astro core needs
|
// Start with the Vite configuration that Astro core needs
|
||||||
let viteConfig: ViteConfigWithSSR = {
|
let viteConfig: ViteConfigWithSSR = {
|
||||||
cacheDir: fileURLToPath(new URL('./node_modules/.vite/', astroConfig.projectRoot)), // using local caches allows Astro to be used in monorepos, etc.
|
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)
|
// Note: SSR API is in beta (https://vitejs.dev/guide/ssr.html)
|
||||||
ssr: {
|
ssr: {
|
||||||
external: [...ALWAYS_EXTERNAL],
|
external: [...ALWAYS_EXTERNAL],
|
||||||
noExternal: [
|
noExternal: [...ALWAYS_NOEXTERNAL, ...astroPackages],
|
||||||
...ALWAYS_NOEXTERNAL,
|
|
||||||
...astroPackages
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,7 +153,7 @@ const COMMON_DEPENDENCIES_NOT_ASTRO = [
|
||||||
'astro',
|
'astro',
|
||||||
'tslib',
|
'tslib',
|
||||||
'typescript',
|
'typescript',
|
||||||
'vite'
|
'vite',
|
||||||
];
|
];
|
||||||
|
|
||||||
const COMMON_PREFIXES_NOT_ASTRO = [
|
const COMMON_PREFIXES_NOT_ASTRO = [
|
||||||
|
@ -174,17 +171,14 @@ const COMMON_PREFIXES_NOT_ASTRO = [
|
||||||
'remark-',
|
'remark-',
|
||||||
'rehype-',
|
'rehype-',
|
||||||
'rollup-plugin-',
|
'rollup-plugin-',
|
||||||
'vite-plugin-'
|
'vite-plugin-',
|
||||||
];
|
];
|
||||||
|
|
||||||
function isCommonNotAstro(dep: string): boolean {
|
function isCommonNotAstro(dep: string): boolean {
|
||||||
return (
|
return (
|
||||||
COMMON_DEPENDENCIES_NOT_ASTRO.includes(dep) ||
|
COMMON_DEPENDENCIES_NOT_ASTRO.includes(dep) ||
|
||||||
COMMON_PREFIXES_NOT_ASTRO.some(
|
COMMON_PREFIXES_NOT_ASTRO.some(
|
||||||
(prefix) =>
|
(prefix) => (prefix.startsWith('@') ? dep.startsWith(prefix) : dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix)) // check prefix omitting @scope/
|
||||||
prefix.startsWith('@')
|
|
||||||
? dep.startsWith(prefix)
|
|
||||||
: dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* 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,
|
* 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.
|
* 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
|
* In the future, we should remove this workaround and most likely implement our own Astro style handling without
|
||||||
|
|
Loading…
Reference in a new issue