forked from open-wc/custom-elements-manifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
143 lines (119 loc) · 3 KB
/
index.d.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import { Module, Package } from 'custom-elements-manifest/schema';
/** Plugin execution context. Pass arbitrary data here. */
export type Context = Record<string, unknown>;
export interface InitializeParams {
/**
* TypeScript API
*/
ts: typeof import('typescript')
/**
* The newly initialized manifest.
*/
customElementsManifest: Package;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
export interface PackageLinkPhaseParams {
/**
* TypeScript API
*/
ts: typeof import('typescript');
/**
* The newly initialized manifest.
*/
customElementsManifest: Package;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
export interface CollectPhaseParams {
/**
* TypeScript API
*/
ts: typeof import('typescript');
/**
* The current TypeScript AST Node
*/
node: import('typescript').Node;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
export interface AnalyzePhaseParams {
/**
* TypeScript API
*/
ts: typeof import('typescript');
/**
* The current TypeScript AST Node
*/
node: import('typescript').Node;
/**
* The current state of the current module's manifest
*/
moduleDoc: Partial<Module>;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
export interface ModuleLinkPhaseParams {
/**
* The completed moduleDoc, i.e. the output of the analyze phase
*/
moduleDoc: Module;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
export interface PackageLinkPhaseParams {
/**
* The completed manifest, i.e. the output of the analyze phase
*/
customElementsManifest: Package;
/**
* Plugin execution context. Pass arbitrary data here.
*/
context: Context;
}
/**
* A Custom Elements Manifest Analyzer plugin
*/
export interface Plugin {
name: string,
/**
* @summary Plugin hook that runs once for each plugin
*/
initialize?(params: InitializeParams): void;
/**
* @summary Plugin hook that runs in the collect phase.
*
* Runs for all modules in a project, before continuing to the `analyzePhase`
*/
collectPhase?(params: CollectPhaseParams): void;
/**
* @summary Plugin hook that runs in the analyze phase.
*
* Runs for each AST node in each module.
* You can use this phase to access a module's AST nodes and mutate the manifest.
*/
analyzePhase?(params: AnalyzePhaseParams): void;
/**
* @summary Plugin hook that runs in the module-link phase.
*
* Post-processing hook that runs for each module, after analyzing.
* All information about your module should now be available.
*/
moduleLinkPhase?(params: ModuleLinkPhaseParams): void;
/**
* @summary Plugin hook that runs in the package-link phase.
*
* Runs once per package, after modules have been parsed and after per-module post-processing
*/
packageLinkPhase?(params: PackageLinkPhaseParams): void;
}