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:
parent
ab0281aee4
commit
a8236cfd86
4 changed files with 13 additions and 5 deletions
4
packages/astro/client.d.ts
vendored
4
packages/astro/client.d.ts
vendored
|
@ -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;
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -81,7 +81,7 @@ export function astroContentVirtualModPlugin({
|
|||
pageOptions: {},
|
||||
},
|
||||
} satisfies AstroPluginMetadata,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
renderChunk(code, chunk) {
|
||||
|
|
4
packages/astro/src/virtual-modules/content.ts
Normal file
4
packages/astro/src/virtual-modules/content.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import * as zod from 'zod';
|
||||
|
||||
export { defineCollection } from '../content/runtime.js';
|
||||
export { zod as z };
|
Loading…
Reference in a new issue