-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
types.ts
66 lines (58 loc) · 1.82 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import type * as vite from 'vite';
import type { InlineConfig } from 'vite';
import type {
AstroConfig,
AstroSettings,
ComponentInstance,
ManifestData,
MiddlewareHandler,
RouteData,
RuntimeMode,
SSRLoadedRenderer,
} from '../../@types/astro.js';
import type { Logger } from '../logger/core.js';
import type { RouteCache } from '../render/route-cache.js';
export type ComponentPath = string;
export type ViteID = string;
export type PageOutput = AstroConfig['output'];
export type StylesheetAsset =
| { type: 'inline'; content: string }
| { type: 'external'; src: string };
export interface PageBuildData {
component: ComponentPath;
route: RouteData;
moduleSpecifier: string;
propagatedStyles: Map<string, Set<StylesheetAsset>>;
propagatedScripts: Map<string, Set<string>>;
hoistedScript: { type: 'inline' | 'external'; value: string } | undefined;
styles: Array<{ depth: number; order: number; sheet: StylesheetAsset }>;
}
export type AllPagesData = Record<ComponentPath, PageBuildData>;
/** Options for the static build */
export interface StaticBuildOptions {
allPages: AllPagesData;
settings: AstroSettings;
logger: Logger;
manifest: ManifestData;
mode: RuntimeMode;
origin: string;
pageNames: string[];
routeCache: RouteCache;
viteConfig: InlineConfig;
teardownCompiler: boolean;
}
type ImportComponentInstance = () => Promise<ComponentInstance>;
export interface SinglePageBuiltModule {
page: ImportComponentInstance;
/**
* The `onRequest` hook exported by the middleware
*/
onRequest?: MiddlewareHandler;
renderers: SSRLoadedRenderer[];
}
export type ViteBuildReturn = Awaited<ReturnType<typeof vite.build>>;
export type RollupOutput = Extract<
Extract<ViteBuildReturn, Exclude<ViteBuildReturn, Array<any>>>,
{ output: any }
>;
export type OutputChunk = Extract<RollupOutput['output'][number], { type: 'chunk' }>;