0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

wip: restructure astro:content module

This commit is contained in:
Nate Moore 2023-12-06 15:35:05 -06:00
parent ab0281aee4
commit a8236cfd86
4 changed files with 13 additions and 5 deletions

View file

@ -148,6 +148,10 @@ declare module 'astro:prefetch' {
export { prefetch, PrefetchOptions } from 'astro/virtual-modules/prefetch.js';
}
declare module 'astro:content' {
export * from 'astro/virtual-modules/content.js'
}
declare module 'astro:i18n' {
export type GetLocaleOptions = import('./dist/virtual-modules/i18n.js').GetLocaleOptions;

View file

@ -14,10 +14,10 @@ import {
} from '../runtime/server/index.js';
import type { ContentLookupMap } from './utils.js';
type LazyImport = () => Promise<any>;
type GlobResult = Record<string, LazyImport>;
type CollectionToEntryMap = Record<string, GlobResult>;
type GetEntryImport = (collection: string, lookupId: string) => Promise<LazyImport>;
export type LazyImport = () => Promise<any>;
export type GlobResult = Record<string, LazyImport>;
export type CollectionToEntryMap = Record<string, GlobResult>;
export type GetEntryImport = (collection: string, lookupId: string) => Promise<LazyImport>;
export function defineCollection(config: any) {
if (!config.type) config.type = 'content';

View file

@ -81,7 +81,7 @@ export function astroContentVirtualModPlugin({
pageOptions: {},
},
} satisfies AstroPluginMetadata,
};
}
}
},
renderChunk(code, chunk) {

View file

@ -0,0 +1,4 @@
import * as zod from 'zod';
export { defineCollection } from '../content/runtime.js';
export { zod as z };