mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
[ci] format
This commit is contained in:
parent
3cc2010927
commit
c32f0c1ab6
1 changed files with 21 additions and 11 deletions
|
@ -68,7 +68,14 @@ export function astroContentVirtualModPlugin({
|
||||||
fs,
|
fs,
|
||||||
});
|
});
|
||||||
const isClient = !args?.ssr;
|
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 {
|
return {
|
||||||
code,
|
code,
|
||||||
|
@ -103,7 +110,7 @@ export async function generateContentEntryFile({
|
||||||
lookupMap,
|
lookupMap,
|
||||||
IS_DEV,
|
IS_DEV,
|
||||||
IS_SERVER,
|
IS_SERVER,
|
||||||
isClient
|
isClient,
|
||||||
}: {
|
}: {
|
||||||
settings: AstroSettings;
|
settings: AstroSettings;
|
||||||
fs: typeof nodeFs;
|
fs: typeof nodeFs;
|
||||||
|
@ -146,15 +153,18 @@ export async function generateContentEntryFile({
|
||||||
renderEntryGlobResult = getStringifiedCollectionFromLookup('render', relContentDir, lookupMap);
|
renderEntryGlobResult = getStringifiedCollectionFromLookup('render', relContentDir, lookupMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
let virtualModContents = nodeFs
|
let virtualModContents =
|
||||||
|
nodeFs
|
||||||
.readFileSync(contentPaths.virtualModTemplate, 'utf-8')
|
.readFileSync(contentPaths.virtualModTemplate, 'utf-8')
|
||||||
.replace('@@CONTENT_DIR@@', relContentDir)
|
.replace('@@CONTENT_DIR@@', relContentDir)
|
||||||
.replace("'@@CONTENT_ENTRY_GLOB_PATH@@'", contentEntryGlobResult)
|
.replace("'@@CONTENT_ENTRY_GLOB_PATH@@'", contentEntryGlobResult)
|
||||||
.replace("'@@DATA_ENTRY_GLOB_PATH@@'", dataEntryGlobResult)
|
.replace("'@@DATA_ENTRY_GLOB_PATH@@'", dataEntryGlobResult)
|
||||||
.replace("'@@RENDER_ENTRY_GLOB_PATH@@'", renderEntryGlobResult)
|
.replace("'@@RENDER_ENTRY_GLOB_PATH@@'", renderEntryGlobResult)
|
||||||
.replace('/* @@LOOKUP_MAP_ASSIGNMENT@@ */', `lookupMap = ${JSON.stringify(lookupMap)};`) +
|
.replace('/* @@LOOKUP_MAP_ASSIGNMENT@@ */', `lookupMap = ${JSON.stringify(lookupMap)};`) +
|
||||||
(isClient ? `
|
(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.');` : '');
|
? `
|
||||||
|
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;
|
return virtualModContents;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue