summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthewp@users.noreply.github.com> 2024-02-22 16:12:42 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-02-22 16:12:42 +0000
commitc32f0c1ab656fe2e87cd331eaec48a39c12a4f19 (patch)
treea87fda39658f4d34d698b4fffe18bb4d7b37e1ae
parent3cc20109277813ccb9578ca87a8b0d680a73c35c (diff)
downloadastro-c32f0c1ab656fe2e87cd331eaec48a39c12a4f19.tar.gz
astro-c32f0c1ab656fe2e87cd331eaec48a39c12a4f19.tar.zst
astro-c32f0c1ab656fe2e87cd331eaec48a39c12a4f19.zip
[ci] format
-rw-r--r--packages/astro/src/content/vite-plugin-content-virtual-mod.ts32
1 files changed, 21 insertions, 11 deletions
diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
index 52f2d65f0..2fbe95eac 100644
--- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
+++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
@@ -68,7 +68,14 @@ export function astroContentVirtualModPlugin({
fs,
});
const isClient = !args?.ssr;
- const code = await generateContentEntryFile({ settings, fs, lookupMap, IS_DEV, IS_SERVER, isClient });
+ const code = await generateContentEntryFile({
+ settings,
+ fs,
+ lookupMap,
+ IS_DEV,
+ IS_SERVER,
+ isClient,
+ });
return {
code,
@@ -103,7 +110,7 @@ export async function generateContentEntryFile({
lookupMap,
IS_DEV,
IS_SERVER,
- isClient
+ isClient,
}: {
settings: AstroSettings;
fs: typeof nodeFs;
@@ -146,15 +153,18 @@ export async function generateContentEntryFile({
renderEntryGlobResult = getStringifiedCollectionFromLookup('render', relContentDir, lookupMap);
}
- let virtualModContents = nodeFs
- .readFileSync(contentPaths.virtualModTemplate, 'utf-8')
- .replace('@@CONTENT_DIR@@', relContentDir)
- .replace("'@@CONTENT_ENTRY_GLOB_PATH@@'", contentEntryGlobResult)
- .replace("'@@DATA_ENTRY_GLOB_PATH@@'", dataEntryGlobResult)
- .replace("'@@RENDER_ENTRY_GLOB_PATH@@'", renderEntryGlobResult)
- .replace('/* @@LOOKUP_MAP_ASSIGNMENT@@ */', `lookupMap = ${JSON.stringify(lookupMap)};`) +
- (isClient ? `
-console.warn('astro:content is only supported running server-side. Using it in the browser will lead to bloated bundles and slow down page load. In the future it will not be supported.');` : '');
+ let virtualModContents =
+ nodeFs
+ .readFileSync(contentPaths.virtualModTemplate, 'utf-8')
+ .replace('@@CONTENT_DIR@@', relContentDir)
+ .replace("'@@CONTENT_ENTRY_GLOB_PATH@@'", contentEntryGlobResult)
+ .replace("'@@DATA_ENTRY_GLOB_PATH@@'", dataEntryGlobResult)
+ .replace("'@@RENDER_ENTRY_GLOB_PATH@@'", renderEntryGlobResult)
+ .replace('/* @@LOOKUP_MAP_ASSIGNMENT@@ */', `lookupMap = ${JSON.stringify(lookupMap)};`) +
+ (isClient
+ ? `
+console.warn('astro:content is only supported running server-side. Using it in the browser will lead to bloated bundles and slow down page load. In the future it will not be supported.');`
+ : '');
return virtualModContents;
}