Skip to content
Source
Sign inSign up
TanStack/cli
Open History to see the last commit

manifest-types.ts

74 lines1.8 KB

1import type { AddOnCompiled, FrameworkDefinition } from './types.js'
2​
3export type ManifestFrameworkDefinition = Omit<
4 FrameworkDefinition,
5 'addOns'
6> & {
7 addOns: Array<AddOnCompiled>
8}
9​
10export type ManifestAddOnMetadata = Omit<
11 AddOnCompiled,
12 'files' | 'deletedFiles' | 'packageTemplate' | 'readme' | 'readmeIsEjs'
14​
15export type ManifestFrameworkMetadata = Omit<
16 ManifestFrameworkDefinition,
17 'base' | 'addOns'
18> & {
19 addOns: Array<ManifestAddOnMetadata>
21​
22export type ManifestCatalog = {
23 frameworks: Array<ManifestFrameworkMetadata>
25​
26export type ManifestTemplateContext = Record<string, any>
27​
28export type ManifestTemplateRenderer = (
29 template: string,
30 context: ManifestTemplateContext,
31) => string | undefined
32​
33export type ManifestTemplateModule = {
34 renderManifestTemplate: ManifestTemplateRenderer
35 hasManifestTemplate?: (template: string) => boolean
37​
38export type ManifestFrameworkChunk = ManifestTemplateModule & {
39 id: string
40 base: Record<string, string>
42​
43export type ManifestAddOnChunk = ManifestTemplateModule & AddOnCompiled
44​
45export type WorkerManifestLoader = {
46 loadCatalog: () => Promise<ManifestCatalog>
47 loadFramework: (frameworkId: string) => Promise<ManifestFrameworkChunk>
48 loadAddOn: (
49 frameworkId: string,
50 addOnId: string,
51 ) => Promise<ManifestAddOnChunk>
53​
54export type WorkerFrameworkManifestModule = ManifestTemplateModule & {
55 framework: {
56 id: string
57 base: Record<string, string>
58 }
60​
61export type WorkerAddOnManifestModule = ManifestTemplateModule & {
62 addOn: AddOnCompiled
64​
65export type WorkerManifestModuleLoader = {
66 loadCatalog: () => Promise<ManifestCatalog>
67 loadFramework: (
68 frameworkId: string,
69 ) => Promise<WorkerFrameworkManifestModule>
70 loadAddOn: (
71 frameworkId: string,
72 addOnId: string,
73 ) => Promise<WorkerAddOnManifestModule>