@stencil/core 5.0.0-beta.0 → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-data/index.d.ts +1 -1
- package/dist/compiler/browser.d.ts +1534 -0
- package/dist/compiler/browser.js +16435 -0
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +1 -1
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-NrvbUOX1.mjs → compiler-C8yf59oh.mjs} +325 -74
- package/dist/declarations/stencil-public-compiler.d.ts +18 -3
- package/dist/declarations/stencil-public-runtime.d.ts +21 -5
- package/dist/{index-DnISpqrd.d.ts → index-BXAcVN2j.d.ts} +3 -11
- package/dist/{index-RrQfiPWK.d.mts → index-BopBfjPu.d.mts} +18 -3
- package/dist/{index-BOrz3rbJ.d.mts → index-DmHmu3y0.d.mts} +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +81 -1
- package/dist/runtime/client/lazy.js +103 -13
- package/dist/runtime/client/runtime.d.ts +30 -12
- package/dist/runtime/client/runtime.js +103 -13
- package/dist/runtime/index.d.ts +28 -2
- package/dist/runtime/index.js +103 -13
- package/dist/runtime/server/index.d.mts +27 -1
- package/dist/runtime/server/index.mjs +101 -11
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/worker.mjs +1 -1
- package/dist/testing/index.d.mts +17 -2
- package/dist/testing/index.mjs +24 -55
- package/package.json +9 -5
|
@@ -0,0 +1,1534 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import "rolldown";
|
|
3
|
+
//#region src/declarations/stencil-public-docs.d.ts
|
|
4
|
+
interface JsonDocMethodParameter {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
docs: string;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/declarations/stencil-public-runtime.d.ts
|
|
11
|
+
type ListenTargetOptions = 'body' | 'document' | 'window';
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/declarations/stencil-public-compiler.d.ts
|
|
14
|
+
type PageReloadStrategy = 'hmr' | 'pageReload' | null;
|
|
15
|
+
/**
|
|
16
|
+
* Common system used by the compiler. All file reads, writes, access, etc. will all use
|
|
17
|
+
* this system. Additionally, throughout each build, the compiler will use an internal
|
|
18
|
+
* in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
|
|
19
|
+
* build all actions the in-memory fs performed will be written to disk using this system.
|
|
20
|
+
* A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
|
|
21
|
+
* will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
|
|
22
|
+
* of the actual platform it's being ran on top of.
|
|
23
|
+
*/
|
|
24
|
+
interface CompilerSystem {
|
|
25
|
+
name: 'node' | 'in-memory';
|
|
26
|
+
version: string;
|
|
27
|
+
events?: BuildEvents;
|
|
28
|
+
details?: SystemDetails;
|
|
29
|
+
/**
|
|
30
|
+
* Add a callback which will be ran when destroy() is called.
|
|
31
|
+
*/
|
|
32
|
+
addDestroy(cb: () => void): void;
|
|
33
|
+
/**
|
|
34
|
+
* Always returns a boolean, does not throw.
|
|
35
|
+
*/
|
|
36
|
+
access(p: string): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* SYNC! Always returns a boolean, does not throw.
|
|
39
|
+
*/
|
|
40
|
+
accessSync(p: string): boolean;
|
|
41
|
+
applyGlobalPatch?(fromDir: string): Promise<void>;
|
|
42
|
+
applyPrerenderGlobalPatch?(opts: {
|
|
43
|
+
devServerHostUrl: string;
|
|
44
|
+
window: any;
|
|
45
|
+
}): void;
|
|
46
|
+
cacheStorage?: CacheStorage;
|
|
47
|
+
checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
|
|
48
|
+
copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
|
|
49
|
+
/**
|
|
50
|
+
* Always returns a boolean if the files were copied or not. Does not throw.
|
|
51
|
+
*/
|
|
52
|
+
copyFile(src: string, dst: string): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Used to destroy any listeners, file watchers or child processes.
|
|
55
|
+
*/
|
|
56
|
+
destroy(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Does not throw.
|
|
59
|
+
*/
|
|
60
|
+
createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
|
|
61
|
+
/**
|
|
62
|
+
* SYNC! Does not throw.
|
|
63
|
+
*/
|
|
64
|
+
createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
|
|
65
|
+
homeDir(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Used to determine if the current context of the terminal is TTY.
|
|
68
|
+
*/
|
|
69
|
+
isTTY(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Each platform has a different way to dynamically import modules.
|
|
72
|
+
*/
|
|
73
|
+
dynamicImport?(p: string): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates the worker controller for the current system.
|
|
76
|
+
*
|
|
77
|
+
* @param maxConcurrentWorkers the max number of concurrent workers to
|
|
78
|
+
* support
|
|
79
|
+
* @returns a worker controller appropriate for the current platform (node.js)
|
|
80
|
+
*/
|
|
81
|
+
createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
|
|
82
|
+
encodeToBase64(str: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* process.exit()
|
|
85
|
+
*/
|
|
86
|
+
exit(exitCode: number): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Optionally provide a fetch() function rather than using the built-in fetch().
|
|
89
|
+
* First arg is a url string or Request object (RequestInfo).
|
|
90
|
+
* Second arg is the RequestInit. Returns the Response object
|
|
91
|
+
*/
|
|
92
|
+
fetch?(input: string | any, init?: any): Promise<any>;
|
|
93
|
+
/**
|
|
94
|
+
* Generates a sha1 digest encoded as HEX
|
|
95
|
+
*/
|
|
96
|
+
generateContentHash?(content: string | any, length?: number): Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Generates a sha1 digest encoded as HEX from a file path
|
|
99
|
+
*/
|
|
100
|
+
generateFileHash?(filePath: string | any, length?: number): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Get the current directory.
|
|
103
|
+
*/
|
|
104
|
+
getCurrentDirectory(): string;
|
|
105
|
+
/**
|
|
106
|
+
* The compiler's executing path.
|
|
107
|
+
*/
|
|
108
|
+
getCompilerExecutingPath(): string;
|
|
109
|
+
getEnvironmentVar?(key: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the absolute file path when for a dependency module.
|
|
112
|
+
*/
|
|
113
|
+
getLocalModulePath(opts: {
|
|
114
|
+
rootDir: string;
|
|
115
|
+
moduleId: string;
|
|
116
|
+
path: string;
|
|
117
|
+
}): string;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the full url when requesting a dependency module to fetch from a CDN.
|
|
120
|
+
*/
|
|
121
|
+
getRemoteModuleUrl(opts: {
|
|
122
|
+
moduleId: string;
|
|
123
|
+
path?: string;
|
|
124
|
+
version?: string;
|
|
125
|
+
}): string;
|
|
126
|
+
/**
|
|
127
|
+
* Async glob task. Only available in NodeJS compiler system.
|
|
128
|
+
*/
|
|
129
|
+
glob?(pattern: string, options: {
|
|
130
|
+
cwd?: string;
|
|
131
|
+
nodir?: boolean;
|
|
132
|
+
[key: string]: any;
|
|
133
|
+
}): Promise<string[]>;
|
|
134
|
+
/**
|
|
135
|
+
* The number of logical processors available to run threads on the user's computer (cpus).
|
|
136
|
+
*/
|
|
137
|
+
hardwareConcurrency: number;
|
|
138
|
+
/**
|
|
139
|
+
* Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
|
|
140
|
+
*/
|
|
141
|
+
isSymbolicLink(p: string): Promise<boolean>;
|
|
142
|
+
lazyRequire?: LazyRequire;
|
|
143
|
+
nextTick(cb: () => void): void;
|
|
144
|
+
/**
|
|
145
|
+
* Normalize file system path.
|
|
146
|
+
*/
|
|
147
|
+
normalizePath(p: string): string;
|
|
148
|
+
onProcessInterrupt?(cb: () => void): void;
|
|
149
|
+
parseYarnLockFile?: (content: string) => {
|
|
150
|
+
type: 'success' | 'merge' | 'conflict';
|
|
151
|
+
object: any;
|
|
152
|
+
};
|
|
153
|
+
platformPath: PlatformPath;
|
|
154
|
+
/**
|
|
155
|
+
* All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
|
|
156
|
+
*/
|
|
157
|
+
readDir(p: string): Promise<string[]>;
|
|
158
|
+
/**
|
|
159
|
+
* SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
|
|
160
|
+
*/
|
|
161
|
+
readDirSync(p: string): string[];
|
|
162
|
+
/**
|
|
163
|
+
* Returns undefined if file is not found. Does not throw.
|
|
164
|
+
*/
|
|
165
|
+
readFile(p: string): Promise<string>;
|
|
166
|
+
readFile(p: string, encoding: 'utf8'): Promise<string>;
|
|
167
|
+
readFile(p: string, encoding: 'binary'): Promise<any>;
|
|
168
|
+
/**
|
|
169
|
+
* SYNC! Returns undefined if file is not found. Does not throw.
|
|
170
|
+
*/
|
|
171
|
+
readFileSync(p: string, encoding?: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* Does not throw.
|
|
174
|
+
*/
|
|
175
|
+
realpath(p: string): Promise<CompilerSystemRealpathResults>;
|
|
176
|
+
/**
|
|
177
|
+
* SYNC! Does not throw.
|
|
178
|
+
*/
|
|
179
|
+
realpathSync(p: string): CompilerSystemRealpathResults;
|
|
180
|
+
/**
|
|
181
|
+
* Remove a callback which will be ran when destroy() is called.
|
|
182
|
+
*/
|
|
183
|
+
removeDestroy(cb: () => void): void;
|
|
184
|
+
/**
|
|
185
|
+
* Rename old path to new path. Does not throw.
|
|
186
|
+
*/
|
|
187
|
+
rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
|
|
188
|
+
resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
|
|
189
|
+
resolvePath(p: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Does not throw.
|
|
192
|
+
*/
|
|
193
|
+
removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
|
|
194
|
+
/**
|
|
195
|
+
* SYNC! Does not throw.
|
|
196
|
+
*/
|
|
197
|
+
removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
|
|
198
|
+
/**
|
|
199
|
+
* Does not throw.
|
|
200
|
+
*/
|
|
201
|
+
removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
|
|
202
|
+
/**
|
|
203
|
+
* SYNC! Does not throw.
|
|
204
|
+
*/
|
|
205
|
+
removeFileSync(p: string): CompilerSystemRemoveFileResults;
|
|
206
|
+
setupCompiler?: (c: {
|
|
207
|
+
ts: any;
|
|
208
|
+
}) => void;
|
|
209
|
+
/**
|
|
210
|
+
* Always returns an object. Does not throw. Check for "error" property if there's an error.
|
|
211
|
+
*/
|
|
212
|
+
stat(p: string): Promise<CompilerFsStats>;
|
|
213
|
+
/**
|
|
214
|
+
* SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
|
|
215
|
+
*/
|
|
216
|
+
statSync(p: string): CompilerFsStats;
|
|
217
|
+
tmpDirSync(): string;
|
|
218
|
+
watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
|
|
219
|
+
/**
|
|
220
|
+
* A `watchFile` implementation in order to hook into the rest of the {@link CompilerSystem} implementation that is
|
|
221
|
+
* used when running Stencil's compiler in "watch mode".
|
|
222
|
+
*
|
|
223
|
+
* It is analogous to TypeScript's `watchFile` implementation.
|
|
224
|
+
*
|
|
225
|
+
* Note, this function may be called for full builds of Stencil projects by the TypeScript compiler. It should not
|
|
226
|
+
* assume that it will only be called in watch mode.
|
|
227
|
+
*
|
|
228
|
+
* This function should not perform any file watcher registration itself. Each `path` provided to it when called
|
|
229
|
+
* should already have been registered as a file to watch.
|
|
230
|
+
*
|
|
231
|
+
* @param path the path to the file that is being watched
|
|
232
|
+
* @param callback a callback to invoke when a file that is being watched has changed in some way
|
|
233
|
+
* @returns an object with a method for unhooking the file watcher from the system
|
|
234
|
+
*/
|
|
235
|
+
watchFile?(path: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
|
|
236
|
+
/**
|
|
237
|
+
* How many milliseconds to wait after a change before calling watch callbacks.
|
|
238
|
+
*/
|
|
239
|
+
watchTimeout?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Does not throw.
|
|
242
|
+
*/
|
|
243
|
+
writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
|
|
244
|
+
/**
|
|
245
|
+
* SYNC! Does not throw.
|
|
246
|
+
*/
|
|
247
|
+
writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
|
|
248
|
+
}
|
|
249
|
+
interface ParsedPath {
|
|
250
|
+
root: string;
|
|
251
|
+
dir: string;
|
|
252
|
+
base: string;
|
|
253
|
+
ext: string;
|
|
254
|
+
name: string;
|
|
255
|
+
}
|
|
256
|
+
interface PlatformPath {
|
|
257
|
+
normalize(p: string): string;
|
|
258
|
+
join(...paths: string[]): string;
|
|
259
|
+
resolve(...pathSegments: string[]): string;
|
|
260
|
+
isAbsolute(p: string): boolean;
|
|
261
|
+
relative(from: string, to: string): string;
|
|
262
|
+
dirname(p: string): string;
|
|
263
|
+
basename(p: string, ext?: string): string;
|
|
264
|
+
extname(p: string): string;
|
|
265
|
+
parse(p: string): ParsedPath;
|
|
266
|
+
sep: string;
|
|
267
|
+
delimiter: string;
|
|
268
|
+
posix: any;
|
|
269
|
+
win32: any;
|
|
270
|
+
}
|
|
271
|
+
interface ResolveModuleIdOptions {
|
|
272
|
+
moduleId: string;
|
|
273
|
+
containingFile?: string;
|
|
274
|
+
exts?: string[];
|
|
275
|
+
packageFilter?: (pkg: any, pkgFile: string) => any;
|
|
276
|
+
}
|
|
277
|
+
interface ResolveModuleIdResults {
|
|
278
|
+
moduleId: string;
|
|
279
|
+
resolveId: string;
|
|
280
|
+
pkgData: {
|
|
281
|
+
name: string;
|
|
282
|
+
version: string;
|
|
283
|
+
[key: string]: any;
|
|
284
|
+
};
|
|
285
|
+
pkgDirPath: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* A controller which provides for communication and coordination between
|
|
289
|
+
* threaded workers.
|
|
290
|
+
*/
|
|
291
|
+
interface WorkerMainController<T extends Record<string, (...args: any[]) => Promise<any>> = Record<string, (...args: any[]) => Promise<any>>> {
|
|
292
|
+
/**
|
|
293
|
+
* Send a given set of arguments to a worker
|
|
294
|
+
*/
|
|
295
|
+
send<K extends keyof T>(methodName: K, ...args: Parameters<T[K]>): ReturnType<T[K]>;
|
|
296
|
+
/**
|
|
297
|
+
* Handle a particular method
|
|
298
|
+
*
|
|
299
|
+
* @param name of the method to be passed to a worker
|
|
300
|
+
* @returns a Promise wrapping the results
|
|
301
|
+
*/
|
|
302
|
+
handler<K extends keyof T>(name: K): T[K];
|
|
303
|
+
/**
|
|
304
|
+
* Destroy the worker represented by this instance, rejecting all outstanding
|
|
305
|
+
* tasks and killing the child process.
|
|
306
|
+
*/
|
|
307
|
+
destroy(): void;
|
|
308
|
+
/**
|
|
309
|
+
* The current setting for the max number of workers
|
|
310
|
+
*/
|
|
311
|
+
maxWorkers: number;
|
|
312
|
+
}
|
|
313
|
+
interface CopyResults {
|
|
314
|
+
diagnostics: Diagnostic[];
|
|
315
|
+
filePaths: string[];
|
|
316
|
+
dirPaths: string[];
|
|
317
|
+
}
|
|
318
|
+
interface SystemDetails {
|
|
319
|
+
cpuModel: string;
|
|
320
|
+
freemem(): number;
|
|
321
|
+
platform: 'darwin' | 'windows' | 'linux' | '';
|
|
322
|
+
release: string;
|
|
323
|
+
totalmem: number;
|
|
324
|
+
}
|
|
325
|
+
interface BuildOnEvents {
|
|
326
|
+
on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
|
|
327
|
+
on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
|
|
328
|
+
on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
|
|
329
|
+
on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
|
|
330
|
+
on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
|
|
331
|
+
on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
|
|
332
|
+
on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
|
|
333
|
+
on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
|
|
334
|
+
on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
|
|
335
|
+
on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
|
|
336
|
+
}
|
|
337
|
+
interface BuildEmitEvents {
|
|
338
|
+
emit(eventName: CompilerEventName, path: string): void;
|
|
339
|
+
emit(eventName: CompilerEventFileAdd, path: string): void;
|
|
340
|
+
emit(eventName: CompilerEventFileDelete, path: string): void;
|
|
341
|
+
emit(eventName: CompilerEventFileUpdate, path: string): void;
|
|
342
|
+
emit(eventName: CompilerEventDirAdd, path: string): void;
|
|
343
|
+
emit(eventName: CompilerEventDirDelete, path: string): void;
|
|
344
|
+
emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
|
|
345
|
+
emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
|
|
346
|
+
emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
|
|
347
|
+
emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
|
|
348
|
+
emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
|
|
349
|
+
}
|
|
350
|
+
interface FsWatchResults {
|
|
351
|
+
dirsAdded: string[];
|
|
352
|
+
dirsDeleted: string[];
|
|
353
|
+
filesUpdated: string[];
|
|
354
|
+
filesAdded: string[];
|
|
355
|
+
filesDeleted: string[];
|
|
356
|
+
}
|
|
357
|
+
interface BuildLog {
|
|
358
|
+
buildId: number;
|
|
359
|
+
messages: string[];
|
|
360
|
+
progress: number;
|
|
361
|
+
}
|
|
362
|
+
interface BuildNoChangeResults {
|
|
363
|
+
buildId: number;
|
|
364
|
+
noChange: boolean;
|
|
365
|
+
}
|
|
366
|
+
interface CompilerBuildResults {
|
|
367
|
+
buildId: number;
|
|
368
|
+
componentGraph?: BuildResultsComponentGraph;
|
|
369
|
+
components: ComponentCompilerMeta[];
|
|
370
|
+
diagnostics: Diagnostic[];
|
|
371
|
+
dirsAdded: string[];
|
|
372
|
+
dirsDeleted: string[];
|
|
373
|
+
duration: number;
|
|
374
|
+
filesAdded: string[];
|
|
375
|
+
filesChanged: string[];
|
|
376
|
+
filesDeleted: string[];
|
|
377
|
+
filesUpdated: string[];
|
|
378
|
+
hasError: boolean;
|
|
379
|
+
hasSuccessfulBuild: boolean;
|
|
380
|
+
hmr?: HotModuleReplacement;
|
|
381
|
+
ssrAppFilePath?: string;
|
|
382
|
+
isRebuild: boolean;
|
|
383
|
+
namespace: string;
|
|
384
|
+
fsNamespace: string;
|
|
385
|
+
outputs: BuildOutput[];
|
|
386
|
+
rootDir: string;
|
|
387
|
+
srcDir: string;
|
|
388
|
+
timestamp: string;
|
|
389
|
+
}
|
|
390
|
+
interface BuildResultsComponentGraph {
|
|
391
|
+
[scopeId: string]: string[];
|
|
392
|
+
}
|
|
393
|
+
interface BuildOutput {
|
|
394
|
+
type: string;
|
|
395
|
+
files: string[];
|
|
396
|
+
}
|
|
397
|
+
interface HotModuleReplacement {
|
|
398
|
+
componentsUpdated?: string[];
|
|
399
|
+
excludeHmr?: string[];
|
|
400
|
+
externalStylesUpdated?: string[];
|
|
401
|
+
imagesUpdated?: string[];
|
|
402
|
+
indexHtmlUpdated?: boolean;
|
|
403
|
+
inlineStylesUpdated?: HmrStyleUpdate[];
|
|
404
|
+
reloadStrategy: PageReloadStrategy;
|
|
405
|
+
scriptsAdded?: string[];
|
|
406
|
+
scriptsDeleted?: string[];
|
|
407
|
+
serviceWorkerUpdated?: boolean;
|
|
408
|
+
versionId?: string;
|
|
409
|
+
}
|
|
410
|
+
interface HmrStyleUpdate {
|
|
411
|
+
styleId: string;
|
|
412
|
+
styleTag: string;
|
|
413
|
+
styleText: string;
|
|
414
|
+
}
|
|
415
|
+
type BuildOnEventRemove = () => boolean;
|
|
416
|
+
interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
|
|
417
|
+
unsubscribeAll(): void;
|
|
418
|
+
}
|
|
419
|
+
interface CompilerBuildStart {
|
|
420
|
+
buildId: number;
|
|
421
|
+
timestamp: string;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* A type describing a function to call when an event is emitted by a file watcher
|
|
425
|
+
* @param fileName the path of the file tied to event
|
|
426
|
+
* @param eventKind a variant describing the type of event that was emitter (added, edited, etc.)
|
|
427
|
+
*/
|
|
428
|
+
type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
|
|
429
|
+
/**
|
|
430
|
+
* A type describing the different types of events that Stencil expects may happen when a file being watched is altered
|
|
431
|
+
* in some way
|
|
432
|
+
*/
|
|
433
|
+
type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
|
|
434
|
+
type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
|
|
435
|
+
type CompilerEventFsChange = 'fsChange';
|
|
436
|
+
type CompilerEventFileUpdate = 'fileUpdate';
|
|
437
|
+
type CompilerEventFileAdd = 'fileAdd';
|
|
438
|
+
type CompilerEventFileDelete = 'fileDelete';
|
|
439
|
+
type CompilerEventDirAdd = 'dirAdd';
|
|
440
|
+
type CompilerEventDirDelete = 'dirDelete';
|
|
441
|
+
type CompilerEventBuildStart = 'buildStart';
|
|
442
|
+
type CompilerEventBuildFinish = 'buildFinish';
|
|
443
|
+
type CompilerEventBuildLog = 'buildLog';
|
|
444
|
+
type CompilerEventBuildNoChange = 'buildNoChange';
|
|
445
|
+
interface CompilerFileWatcher {
|
|
446
|
+
close(): void | Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
interface CompilerFsStats {
|
|
449
|
+
/**
|
|
450
|
+
* If it's a directory. `false` if there was an error.
|
|
451
|
+
*/
|
|
452
|
+
isDirectory: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* If it's a file. `false` if there was an error.
|
|
455
|
+
*/
|
|
456
|
+
isFile: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* If it's a symlink. `false` if there was an error.
|
|
459
|
+
*/
|
|
460
|
+
isSymbolicLink: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* The size of the file in bytes. `0` for directories or if there was an error.
|
|
463
|
+
*/
|
|
464
|
+
size: number;
|
|
465
|
+
/**
|
|
466
|
+
* The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
|
|
467
|
+
*/
|
|
468
|
+
mtimeMs?: number;
|
|
469
|
+
/**
|
|
470
|
+
* Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
|
|
471
|
+
*/
|
|
472
|
+
error: any;
|
|
473
|
+
}
|
|
474
|
+
interface CompilerSystemCreateDirectoryOptions {
|
|
475
|
+
/**
|
|
476
|
+
* Indicates whether parent directories should be created.
|
|
477
|
+
* @default false
|
|
478
|
+
*/
|
|
479
|
+
recursive?: boolean;
|
|
480
|
+
/**
|
|
481
|
+
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
482
|
+
* @default 0o777.
|
|
483
|
+
*/
|
|
484
|
+
mode?: number;
|
|
485
|
+
}
|
|
486
|
+
interface CompilerSystemCreateDirectoryResults {
|
|
487
|
+
basename: string;
|
|
488
|
+
dirname: string;
|
|
489
|
+
path: string;
|
|
490
|
+
newDirs: string[];
|
|
491
|
+
error: any;
|
|
492
|
+
}
|
|
493
|
+
interface CompilerSystemRemoveDirectoryOptions {
|
|
494
|
+
/**
|
|
495
|
+
* Indicates whether child files and subdirectories should be removed.
|
|
496
|
+
* @default false
|
|
497
|
+
*/
|
|
498
|
+
recursive?: boolean;
|
|
499
|
+
}
|
|
500
|
+
interface CompilerSystemRemoveDirectoryResults {
|
|
501
|
+
basename: string;
|
|
502
|
+
dirname: string;
|
|
503
|
+
path: string;
|
|
504
|
+
removedDirs: string[];
|
|
505
|
+
removedFiles: string[];
|
|
506
|
+
error: any;
|
|
507
|
+
}
|
|
508
|
+
interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
|
|
509
|
+
renamed: CompilerSystemRenamedPath[];
|
|
510
|
+
oldDirs: string[];
|
|
511
|
+
oldFiles: string[];
|
|
512
|
+
newDirs: string[];
|
|
513
|
+
newFiles: string[];
|
|
514
|
+
error: any;
|
|
515
|
+
}
|
|
516
|
+
interface CompilerSystemRenamedPath {
|
|
517
|
+
oldPath: string;
|
|
518
|
+
newPath: string;
|
|
519
|
+
isFile: boolean;
|
|
520
|
+
isDirectory: boolean;
|
|
521
|
+
}
|
|
522
|
+
interface CompilerSystemRealpathResults {
|
|
523
|
+
path: string;
|
|
524
|
+
error: any;
|
|
525
|
+
}
|
|
526
|
+
interface CompilerSystemRemoveFileResults {
|
|
527
|
+
basename: string;
|
|
528
|
+
dirname: string;
|
|
529
|
+
path: string;
|
|
530
|
+
error: any;
|
|
531
|
+
}
|
|
532
|
+
interface CompilerSystemWriteFileResults {
|
|
533
|
+
path: string;
|
|
534
|
+
error: any;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* A file and/or directory copy operation that may be specified as part of
|
|
538
|
+
* certain output targets for Stencil (in particular `loader-bundle`,
|
|
539
|
+
* `standalone`, and `www`).
|
|
540
|
+
*/
|
|
541
|
+
interface CopyTask {
|
|
542
|
+
/**
|
|
543
|
+
* The source file path for a copy operation. This may be an absolute or
|
|
544
|
+
* relative path to a directory or a file, and may also include a glob
|
|
545
|
+
* pattern.
|
|
546
|
+
*
|
|
547
|
+
* If the path is a relative path it will be treated as relative to
|
|
548
|
+
* `Config.srcDir`.
|
|
549
|
+
*/
|
|
550
|
+
src: string;
|
|
551
|
+
/**
|
|
552
|
+
* An optional destination file path for a copy operation. This may be an
|
|
553
|
+
* absolute or relative path.
|
|
554
|
+
*
|
|
555
|
+
* If relative, this will be treated as relative to the output directory for
|
|
556
|
+
* the output target for which this copy operation is configured.
|
|
557
|
+
*/
|
|
558
|
+
dest?: string;
|
|
559
|
+
/**
|
|
560
|
+
* Additional glob patterns to exclude from the copy operation, merged with
|
|
561
|
+
* the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
|
|
562
|
+
* `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
|
|
563
|
+
*/
|
|
564
|
+
ignore?: string[];
|
|
565
|
+
/**
|
|
566
|
+
* Whether or not Stencil should issue warnings if it cannot find the
|
|
567
|
+
* specified source files or directories. Defaults to `false`.
|
|
568
|
+
*
|
|
569
|
+
* To receive warnings if a copy task source can't be found set this to
|
|
570
|
+
* `true`.
|
|
571
|
+
*/
|
|
572
|
+
warn?: boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Whether or not directory structure should be preserved when copying files
|
|
575
|
+
* from a source directory. Defaults to `true` if no `dest` path is supplied,
|
|
576
|
+
* else it defaults to `false`.
|
|
577
|
+
*
|
|
578
|
+
* If this is set to `false`, all the files from a source directory will be
|
|
579
|
+
* copied directly to the destination directory, but if it's set to `true` they
|
|
580
|
+
* will be copied to a new directory inside the destination directory with
|
|
581
|
+
* the same name as their original source directory.
|
|
582
|
+
*
|
|
583
|
+
* So if, for instance, `src` is set to `"images"` and `keepDirStructure` is
|
|
584
|
+
* set to `true` the copy task will then produce the following directory
|
|
585
|
+
* structure:
|
|
586
|
+
*
|
|
587
|
+
* ```
|
|
588
|
+
* images
|
|
589
|
+
* └── foo.png
|
|
590
|
+
* dist
|
|
591
|
+
* └── images
|
|
592
|
+
* └── foo.png
|
|
593
|
+
* ```
|
|
594
|
+
*
|
|
595
|
+
* Conversely if `keepDirStructure` is set to `false` then files in `images/`
|
|
596
|
+
* will be copied to `dist` without first creating a new subdirectory,
|
|
597
|
+
* resulting in the following directory structure:
|
|
598
|
+
*
|
|
599
|
+
* ```
|
|
600
|
+
* images
|
|
601
|
+
* └── foo.png
|
|
602
|
+
* dist
|
|
603
|
+
* └── foo.png
|
|
604
|
+
* ```
|
|
605
|
+
*
|
|
606
|
+
* If a `dest` path is supplied then `keepDirStructure`
|
|
607
|
+
* will default to `false`, so that Stencil will write the
|
|
608
|
+
* copied files directly into the `dest` directory without creating a new
|
|
609
|
+
* subdirectory. This behavior can be overridden by setting
|
|
610
|
+
* `keepDirStructure` to `true`.
|
|
611
|
+
*/
|
|
612
|
+
keepDirStructure?: boolean;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* This sets the log level hierarchy for our terminal logger, ranging from
|
|
616
|
+
* most to least verbose.
|
|
617
|
+
*
|
|
618
|
+
* Ordering the levels like this lets us easily check whether we should log a
|
|
619
|
+
* message at a given time. For instance, if the log level is set to `'warn'`,
|
|
620
|
+
* then anything passed to the logger with level `'warn'` or `'error'` should
|
|
621
|
+
* be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
|
|
622
|
+
*
|
|
623
|
+
* If we have a current log level `currentLevel` and a message with level
|
|
624
|
+
* `msgLevel` is passed to the logger, we can determine whether or not we should
|
|
625
|
+
* log it by checking if the log level on the message is further up or at the
|
|
626
|
+
* same level in the hierarchy than `currentLevel`, like so:
|
|
627
|
+
*
|
|
628
|
+
* ```ts
|
|
629
|
+
* LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
|
|
630
|
+
* ```
|
|
631
|
+
*
|
|
632
|
+
* NOTE: for the reasons described above, do not change the order of the entries
|
|
633
|
+
* in this array without good reason!
|
|
634
|
+
*/
|
|
635
|
+
declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
636
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
637
|
+
/**
|
|
638
|
+
* Abstract interface representing a logger with the capability to accept log
|
|
639
|
+
* messages at various levels (debug, info, warn, and error), set colors, log
|
|
640
|
+
* time spans, print diagnostic messages, and more.
|
|
641
|
+
*
|
|
642
|
+
* A Node.js-specific implementation of this interface is used when Stencil is
|
|
643
|
+
* building and compiling a project.
|
|
644
|
+
*/
|
|
645
|
+
interface Logger {
|
|
646
|
+
enableColors: (useColors: boolean) => void;
|
|
647
|
+
setLevel: (level: LogLevel) => void;
|
|
648
|
+
getLevel: () => LogLevel;
|
|
649
|
+
debug: (...msg: any[]) => void;
|
|
650
|
+
info: (...msg: any[]) => void;
|
|
651
|
+
warn: (...msg: any[]) => void;
|
|
652
|
+
error: (...msg: any[]) => void;
|
|
653
|
+
createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
|
|
654
|
+
printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
|
|
655
|
+
red: (msg: string) => string;
|
|
656
|
+
green: (msg: string) => string;
|
|
657
|
+
yellow: (msg: string) => string;
|
|
658
|
+
blue: (msg: string) => string;
|
|
659
|
+
magenta: (msg: string) => string;
|
|
660
|
+
cyan: (msg: string) => string;
|
|
661
|
+
gray: (msg: string) => string;
|
|
662
|
+
bold: (msg: string) => string;
|
|
663
|
+
dim: (msg: string) => string;
|
|
664
|
+
bgRed: (msg: string) => string;
|
|
665
|
+
emoji: (e: string) => string;
|
|
666
|
+
setLogFilePath?: (p: string) => void;
|
|
667
|
+
writeLogs?: (append: boolean) => void;
|
|
668
|
+
createLineUpdater?: () => Promise<LoggerLineUpdater>;
|
|
669
|
+
}
|
|
670
|
+
interface LoggerLineUpdater {
|
|
671
|
+
update(text: string): Promise<void>;
|
|
672
|
+
stop(): Promise<void>;
|
|
673
|
+
}
|
|
674
|
+
interface LoggerTimeSpan {
|
|
675
|
+
duration(): number;
|
|
676
|
+
finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
|
|
677
|
+
}
|
|
678
|
+
interface Diagnostic {
|
|
679
|
+
absFilePath?: string | undefined;
|
|
680
|
+
code?: string;
|
|
681
|
+
columnNumber?: number | undefined;
|
|
682
|
+
debugText?: string;
|
|
683
|
+
header?: string;
|
|
684
|
+
language?: string;
|
|
685
|
+
level: 'error' | 'warn' | 'info' | 'log' | 'debug';
|
|
686
|
+
lineNumber?: number | undefined;
|
|
687
|
+
lines: PrintLine[];
|
|
688
|
+
messageText: string;
|
|
689
|
+
relFilePath?: string | undefined;
|
|
690
|
+
type: string;
|
|
691
|
+
}
|
|
692
|
+
interface CacheStorage {
|
|
693
|
+
get(key: string): Promise<any>;
|
|
694
|
+
set(key: string, value: any): Promise<void>;
|
|
695
|
+
}
|
|
696
|
+
interface LazyRequire {
|
|
697
|
+
ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
|
|
698
|
+
require(fromDir: string, moduleId: string): any;
|
|
699
|
+
getModulePath(fromDir: string, moduleId: string): string;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Options for Stencil's string-to-string transpiler
|
|
703
|
+
*/
|
|
704
|
+
interface TranspileOptions {
|
|
705
|
+
/**
|
|
706
|
+
* A component can be defined as a custom element by using `customelement`, or the
|
|
707
|
+
* component class can be exported by using `module`. Set to `null` to leave the
|
|
708
|
+
* class's own export as-is (used with `componentMetadata: 'compilerstatic'` for
|
|
709
|
+
* unit-testing preprocessors). Default is `customelement`.
|
|
710
|
+
*/
|
|
711
|
+
componentExport?: 'customelement' | 'module' | string | null | undefined;
|
|
712
|
+
/**
|
|
713
|
+
* Sets how and if component metadata should be assigned on the compiled
|
|
714
|
+
* component output. The `compilerstatic` value will set the metadata to
|
|
715
|
+
* a static `COMPILER_META` getter on the component class. This option
|
|
716
|
+
* is useful for unit testing preprocessors. Default is `null`.
|
|
717
|
+
*/
|
|
718
|
+
componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
|
|
719
|
+
/**
|
|
720
|
+
* The actual internal import path for any `@stencil/core` imports.
|
|
721
|
+
* Default is `@stencil/core/runtime/client/standalone`.
|
|
722
|
+
*/
|
|
723
|
+
coreImportPath?: string;
|
|
724
|
+
/**
|
|
725
|
+
* The current working directory. Default is `/`.
|
|
726
|
+
*/
|
|
727
|
+
currentDirectory?: string;
|
|
728
|
+
/**
|
|
729
|
+
* The filename of the code being compiled. Default is `module.tsx`.
|
|
730
|
+
*/
|
|
731
|
+
file?: string;
|
|
732
|
+
/**
|
|
733
|
+
* Module format to use for the compiled code output, which can be either `esm` or `cjs`.
|
|
734
|
+
* Default is `esm`.
|
|
735
|
+
*/
|
|
736
|
+
module?: 'cjs' | 'esm' | string;
|
|
737
|
+
/**
|
|
738
|
+
* Sets how and if any properties, methods and events are proxied on the
|
|
739
|
+
* component class. The `defineproperty` value sets the getters and setters
|
|
740
|
+
* using Object.defineProperty. Default is `defineproperty`.
|
|
741
|
+
*/
|
|
742
|
+
proxy?: 'defineproperty' | string | undefined;
|
|
743
|
+
/**
|
|
744
|
+
* How component styles should be associated to the component. The `static`
|
|
745
|
+
* setting will assign the styles as a static getter on the component class.
|
|
746
|
+
* Set to `null` to skip the assignment entirely (and leave any `styleUrl`
|
|
747
|
+
* import unresolved) - useful for unit-testing preprocessors that don't
|
|
748
|
+
* need real stylesheets.
|
|
749
|
+
*/
|
|
750
|
+
style?: 'static' | string | null | undefined;
|
|
751
|
+
/**
|
|
752
|
+
* How style data should be added for imports. For example, the `queryparams` value
|
|
753
|
+
* adds the component's tagname and encapsulation info as querystring parameter
|
|
754
|
+
* to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
|
|
755
|
+
* style data can be used by bundlers to further optimize each component's css.
|
|
756
|
+
* Set to `null` to not include the querystring parameters. Default is `queryparams`.
|
|
757
|
+
*/
|
|
758
|
+
styleImportData?: 'queryparams' | string | undefined;
|
|
759
|
+
/**
|
|
760
|
+
* The JavaScript source target TypeScript should transpile to. Values can be
|
|
761
|
+
* `latest`, `esnext`, `es2020`, `es2017`, or `es2015`. Defaults to `latest`.
|
|
762
|
+
*/
|
|
763
|
+
target?: CompileTarget;
|
|
764
|
+
/**
|
|
765
|
+
* Create a source map. Using `inline` will inline the source map into the
|
|
766
|
+
* code, otherwise the source map will be in the returned `map` property.
|
|
767
|
+
* Default is `true`.
|
|
768
|
+
*/
|
|
769
|
+
sourceMap?: boolean | 'inline';
|
|
770
|
+
/**
|
|
771
|
+
* Base directory to resolve non-relative module names. Same as the `baseUrl`
|
|
772
|
+
* TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
|
|
773
|
+
*/
|
|
774
|
+
baseUrl?: string;
|
|
775
|
+
/**
|
|
776
|
+
* List of path mapping entries for module names to locations relative to the `baseUrl`.
|
|
777
|
+
* Same as the `paths` TypeScript compiler option:
|
|
778
|
+
* https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
|
|
779
|
+
*/
|
|
780
|
+
paths?: {
|
|
781
|
+
[key: string]: string[];
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* JSX mode for TypeScript compilation. Can be 'react', 'react-jsx', 'react-jsxdev', etc.
|
|
785
|
+
* Same as the `jsx` TypeScript compiler option.
|
|
786
|
+
*/
|
|
787
|
+
jsx?: number;
|
|
788
|
+
/**
|
|
789
|
+
* Module specifier for JSX factory. Used with automatic JSX runtime.
|
|
790
|
+
* Same as the `jsxImportSource` TypeScript compiler option.
|
|
791
|
+
*/
|
|
792
|
+
jsxImportSource?: string;
|
|
793
|
+
/**
|
|
794
|
+
* Passed in Stencil Compiler System, otherwise falls back to the internal in-memory only system.
|
|
795
|
+
*/
|
|
796
|
+
sys?: CompilerSystem;
|
|
797
|
+
/**
|
|
798
|
+
* This option enables the same behavior as {@link Config.transformAliasedImportPaths}, transforming paths aliased in
|
|
799
|
+
* `tsconfig.json` to relative paths.
|
|
800
|
+
*/
|
|
801
|
+
transformAliasedImportPaths?: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* List of tags to transform, by default only the incoming component tag is transformed
|
|
804
|
+
*/
|
|
805
|
+
tagsToTransform?: string[];
|
|
806
|
+
/**
|
|
807
|
+
* Adds `transformTag` calls to css strings and querySelector(All) calls
|
|
808
|
+
*/
|
|
809
|
+
additionalTagTransformers?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Callback used to resolve parent-class source for inheritance-chain analysis.
|
|
812
|
+
* Called when a component's `extends` clause references a class from another
|
|
813
|
+
* module. Return the resolved absolute path and source text of that module,
|
|
814
|
+
* or `null` to skip inheritance resolution for that specifier.
|
|
815
|
+
*
|
|
816
|
+
* @example
|
|
817
|
+
* ```ts
|
|
818
|
+
* transpile(myComponentCode, {
|
|
819
|
+
* resolveImport: (specifier, importer) => {
|
|
820
|
+
* const resolved = require.resolve(specifier, { paths: [path.dirname(importer)] });
|
|
821
|
+
* return { code: fs.readFileSync(resolved, 'utf8'), path: resolved };
|
|
822
|
+
* },
|
|
823
|
+
* });
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
resolveImport?: (specifier: string, importer: string) => {
|
|
827
|
+
code: string;
|
|
828
|
+
path: string;
|
|
829
|
+
} | null;
|
|
830
|
+
/**
|
|
831
|
+
* When `true` class declarations at the end of a `@Component` inheritance chain
|
|
832
|
+
* * that have no `extends` clause * will get `extends HTMLElement` injected, and a minimal
|
|
833
|
+
* `constructor() { super(); }`. Any stencil static meta-getters are also stripped.
|
|
834
|
+
*/
|
|
835
|
+
transformAsBaseClass?: boolean;
|
|
836
|
+
/**
|
|
837
|
+
* Overrides for Stencil's BUILD feature flags in the generated output.
|
|
838
|
+
* When set, a BUILD mutation statement is prepended to the compiled code so
|
|
839
|
+
* that the specified flags take effect for this component at runtime.
|
|
840
|
+
*/
|
|
841
|
+
buildOverrides?: BuildOverrides;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Keys of {@link BuildConditionals} that can be meaningfully overridden at
|
|
845
|
+
* transpile time — config-driven flags that are not derived from component
|
|
846
|
+
* scanning or runtime environment detection.
|
|
847
|
+
*/
|
|
848
|
+
type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
|
|
849
|
+
/**
|
|
850
|
+
* Subset of Stencil's BUILD feature flags that can be overridden at transpile
|
|
851
|
+
* time. Derived from {@link BuildConditionals} via `Pick` so the field list
|
|
852
|
+
* and types stay in sync with the authoritative definition.
|
|
853
|
+
*/
|
|
854
|
+
type BuildOverrides = Pick<BuildConditionals, BuildOverrideKeys>;
|
|
855
|
+
type CompileTarget = 'latest' | 'esnext' | 'es2022' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | string | undefined;
|
|
856
|
+
interface TranspileResults {
|
|
857
|
+
code: string;
|
|
858
|
+
data?: any[];
|
|
859
|
+
diagnostics: Diagnostic[];
|
|
860
|
+
imports?: {
|
|
861
|
+
path: string;
|
|
862
|
+
}[];
|
|
863
|
+
inputFileExtension: string;
|
|
864
|
+
inputFilePath: string;
|
|
865
|
+
map: any;
|
|
866
|
+
outputFilePath: string;
|
|
867
|
+
}
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/declarations/stencil-private.d.ts
|
|
870
|
+
interface PrintLine {
|
|
871
|
+
lineIndex: number;
|
|
872
|
+
lineNumber: number;
|
|
873
|
+
text: string;
|
|
874
|
+
errorCharStart: number;
|
|
875
|
+
errorLength?: number;
|
|
876
|
+
}
|
|
877
|
+
interface BuildFeatures {
|
|
878
|
+
style: boolean;
|
|
879
|
+
mode: boolean;
|
|
880
|
+
formAssociated: boolean;
|
|
881
|
+
shadowDom: boolean;
|
|
882
|
+
shadowDelegatesFocus: boolean;
|
|
883
|
+
shadowModeClosed: boolean;
|
|
884
|
+
shadowSlotAssignmentManual: boolean;
|
|
885
|
+
shadowClonable: boolean;
|
|
886
|
+
shadowSerializable: boolean;
|
|
887
|
+
scoped: boolean;
|
|
888
|
+
/**
|
|
889
|
+
* Every component has a render function
|
|
890
|
+
*/
|
|
891
|
+
allRenderFn: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* At least one component has a render function
|
|
894
|
+
*/
|
|
895
|
+
hasRenderFn: boolean;
|
|
896
|
+
vdomRender: boolean;
|
|
897
|
+
vdomAttribute: boolean;
|
|
898
|
+
vdomClass: boolean;
|
|
899
|
+
vdomFunctional: boolean;
|
|
900
|
+
vdomKey: boolean;
|
|
901
|
+
vdomListener: boolean;
|
|
902
|
+
vdomPropOrAttr: boolean;
|
|
903
|
+
/** True when at least one component uses the explicit `attr:`/`prop:` JSX prefix. */
|
|
904
|
+
vdomPropOrAttrPrefix: boolean;
|
|
905
|
+
vdomRef: boolean;
|
|
906
|
+
vdomStyle: boolean;
|
|
907
|
+
vdomText: boolean;
|
|
908
|
+
vdomXlink: boolean;
|
|
909
|
+
vdomSignals: boolean;
|
|
910
|
+
slotRelocation: boolean;
|
|
911
|
+
patchAll: boolean;
|
|
912
|
+
patchChildren: boolean;
|
|
913
|
+
patchClone: boolean;
|
|
914
|
+
patchInsert: boolean;
|
|
915
|
+
slot: boolean;
|
|
916
|
+
svg: boolean;
|
|
917
|
+
element: boolean;
|
|
918
|
+
event: boolean;
|
|
919
|
+
hostListener: boolean;
|
|
920
|
+
hostListenerTargetWindow: boolean;
|
|
921
|
+
hostListenerTargetDocument: boolean;
|
|
922
|
+
hostListenerTargetBody: boolean;
|
|
923
|
+
hostListenerTarget: boolean;
|
|
924
|
+
method: boolean;
|
|
925
|
+
prop: boolean;
|
|
926
|
+
propChangeCallback: boolean;
|
|
927
|
+
propMutable: boolean;
|
|
928
|
+
state: boolean;
|
|
929
|
+
member: boolean;
|
|
930
|
+
updatable: boolean;
|
|
931
|
+
propBoolean: boolean;
|
|
932
|
+
propNumber: boolean;
|
|
933
|
+
propString: boolean;
|
|
934
|
+
serializer: boolean;
|
|
935
|
+
deserializer: boolean;
|
|
936
|
+
lifecycle: boolean;
|
|
937
|
+
asyncLoading: boolean;
|
|
938
|
+
observeAttribute: boolean;
|
|
939
|
+
reflect: boolean;
|
|
940
|
+
taskQueue: boolean;
|
|
941
|
+
}
|
|
942
|
+
interface BuildConditionals extends Partial<BuildFeatures> {
|
|
943
|
+
hotModuleReplacement?: boolean;
|
|
944
|
+
isDebug?: boolean;
|
|
945
|
+
isTesting?: boolean;
|
|
946
|
+
isDev?: boolean;
|
|
947
|
+
devTools?: boolean;
|
|
948
|
+
invisiblePrehydration?: boolean;
|
|
949
|
+
hydrateServerSide?: boolean;
|
|
950
|
+
hydrateClientSide?: boolean;
|
|
951
|
+
lifecycleDOMEvents?: boolean;
|
|
952
|
+
cssAnnotations?: boolean;
|
|
953
|
+
lazyLoad?: boolean;
|
|
954
|
+
profile?: boolean;
|
|
955
|
+
constructableCSS?: boolean;
|
|
956
|
+
/** True when `compat.lightDomPatches === true` - enables `applyLightDomPatches` shortcut. */
|
|
957
|
+
lightDomPatches?: boolean;
|
|
958
|
+
/** Patch `childNodes`/`children` getters on light-dom slotted components. */
|
|
959
|
+
slotChildNodes?: boolean;
|
|
960
|
+
/** Patch `cloneNode()` on light-dom slotted components. */
|
|
961
|
+
slotCloneNode?: boolean;
|
|
962
|
+
/** Patch `appendChild`/`insertBefore`/`removeChild` on light-dom slotted components. */
|
|
963
|
+
slotDomMutations?: boolean;
|
|
964
|
+
/** Patch `textContent` on light-dom slotted components. */
|
|
965
|
+
slotTextContent?: boolean;
|
|
966
|
+
hydratedAttribute?: boolean;
|
|
967
|
+
hydratedClass?: boolean;
|
|
968
|
+
hydratedSelectorName?: string;
|
|
969
|
+
/** True when a global-style input contains `@import "stencil-hydrate"` - suppresses dynamic style injection in the loader. */
|
|
970
|
+
staticHydrationStyles?: boolean;
|
|
971
|
+
initializeNextTick?: boolean;
|
|
972
|
+
asyncQueue?: boolean;
|
|
973
|
+
additionalTagTransformers?: boolean | 'prod';
|
|
974
|
+
signalBacking?: boolean;
|
|
975
|
+
/** True when JSX signal bypass is active - text nodes and attributes backed by Signal objects update the DOM directly. Auto-enabled when `signalBacking: true`. */
|
|
976
|
+
vdomSignals?: boolean;
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Record, for a specific component, whether or not it has various features
|
|
980
|
+
* which need to be handled correctly in the compilation pipeline.
|
|
981
|
+
*
|
|
982
|
+
* Note: this must be serializable to JSON.
|
|
983
|
+
*/
|
|
984
|
+
interface ComponentCompilerFeatures {
|
|
985
|
+
hasAttribute: boolean;
|
|
986
|
+
hasAttributeChangedCallbackFn: boolean;
|
|
987
|
+
hasComponentWillLoadFn: boolean;
|
|
988
|
+
hasComponentDidLoadFn: boolean;
|
|
989
|
+
hasComponentShouldUpdateFn: boolean;
|
|
990
|
+
hasComponentWillUpdateFn: boolean;
|
|
991
|
+
hasComponentDidUpdateFn: boolean;
|
|
992
|
+
hasComponentWillRenderFn: boolean;
|
|
993
|
+
hasComponentDidRenderFn: boolean;
|
|
994
|
+
hasConnectedCallbackFn: boolean;
|
|
995
|
+
hasDeserializer: boolean;
|
|
996
|
+
hasDisconnectedCallbackFn: boolean;
|
|
997
|
+
hasElement: boolean;
|
|
998
|
+
hasEvent: boolean;
|
|
999
|
+
hasLifecycle: boolean;
|
|
1000
|
+
hasListener: boolean;
|
|
1001
|
+
hasListenerTarget: boolean;
|
|
1002
|
+
hasListenerTargetWindow: boolean;
|
|
1003
|
+
hasListenerTargetDocument: boolean;
|
|
1004
|
+
hasListenerTargetBody: boolean;
|
|
1005
|
+
hasMember: boolean;
|
|
1006
|
+
hasMethod: boolean;
|
|
1007
|
+
hasMode: boolean;
|
|
1008
|
+
hasModernPropertyDecls: boolean;
|
|
1009
|
+
hasPatchAll: boolean;
|
|
1010
|
+
hasPatchChildren: boolean;
|
|
1011
|
+
hasPatchClone: boolean;
|
|
1012
|
+
hasPatchInsert: boolean;
|
|
1013
|
+
hasProp: boolean;
|
|
1014
|
+
hasPropBoolean: boolean;
|
|
1015
|
+
hasPropNumber: boolean;
|
|
1016
|
+
hasPropString: boolean;
|
|
1017
|
+
hasPropMutable: boolean;
|
|
1018
|
+
hasReflect: boolean;
|
|
1019
|
+
hasRenderFn: boolean;
|
|
1020
|
+
hasSerializer: boolean;
|
|
1021
|
+
hasSlot: boolean;
|
|
1022
|
+
hasState: boolean;
|
|
1023
|
+
hasStyle: boolean;
|
|
1024
|
+
hasVdomAttribute: boolean;
|
|
1025
|
+
hasVdomClass: boolean;
|
|
1026
|
+
hasVdomFunctional: boolean;
|
|
1027
|
+
hasVdomKey: boolean;
|
|
1028
|
+
hasVdomListener: boolean;
|
|
1029
|
+
hasVdomPropOrAttr: boolean;
|
|
1030
|
+
hasVdomPropOrAttrPrefix: boolean;
|
|
1031
|
+
hasVdomRef: boolean;
|
|
1032
|
+
hasVdomRender: boolean;
|
|
1033
|
+
hasVdomStyle: boolean;
|
|
1034
|
+
hasVdomText: boolean;
|
|
1035
|
+
hasVdomXlink: boolean;
|
|
1036
|
+
hasSignalsImport: boolean;
|
|
1037
|
+
hasWatchCallback: boolean;
|
|
1038
|
+
htmlAttrNames: string[];
|
|
1039
|
+
htmlTagNames: string[];
|
|
1040
|
+
htmlParts: string[];
|
|
1041
|
+
htmlSlots: string[];
|
|
1042
|
+
isUpdateable: boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* A plain component is one that doesn't have:
|
|
1045
|
+
* - any members decorated with `@Prop()`, `@State()`, `@Element()`, `@Method()`
|
|
1046
|
+
* - any methods decorated with `@Listen()`
|
|
1047
|
+
* - any styles
|
|
1048
|
+
* - any lifecycle methods, including `render()`
|
|
1049
|
+
*/
|
|
1050
|
+
isPlain: boolean;
|
|
1051
|
+
/**
|
|
1052
|
+
* A collection of tag names of web components that a component references in its JSX/h() function
|
|
1053
|
+
*/
|
|
1054
|
+
potentialCmpRefs: string[];
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Metadata about a given component
|
|
1058
|
+
*
|
|
1059
|
+
* Note: must be serializable to JSON!
|
|
1060
|
+
*/
|
|
1061
|
+
interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
1062
|
+
assetsDirs: CompilerAssetDir[];
|
|
1063
|
+
/**
|
|
1064
|
+
* The name to which an `ElementInternals` object (the return value of
|
|
1065
|
+
* `HTMLElement.attachInternals`) should be attached at runtime. If this is
|
|
1066
|
+
* `null` then `attachInternals` should not be called.
|
|
1067
|
+
*/
|
|
1068
|
+
attachInternalsMemberName: string | null;
|
|
1069
|
+
/**
|
|
1070
|
+
* Custom states to initialize on the ElementInternals.states CustomStateSet.
|
|
1071
|
+
* These are defined via @AttachInternals({ states: {...} }).
|
|
1072
|
+
*/
|
|
1073
|
+
attachInternalsCustomStates: ComponentCompilerCustomState[];
|
|
1074
|
+
componentClassName: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* A list of web component tag names that are either:
|
|
1077
|
+
* - directly referenced in a Stencil component's JSX/h() function
|
|
1078
|
+
* - are referenced by a web component that is directly referenced in a Stencil component's JSX/h() function
|
|
1079
|
+
*/
|
|
1080
|
+
dependencies: string[];
|
|
1081
|
+
/**
|
|
1082
|
+
* A list of web component tag names that either:
|
|
1083
|
+
* - directly reference the current component directly in their JSX/h() function
|
|
1084
|
+
* - indirectly/transitively reference the current component directly in their JSX/h() function
|
|
1085
|
+
*/
|
|
1086
|
+
dependents: string[];
|
|
1087
|
+
deserializers: ComponentCompilerChangeHandler[];
|
|
1088
|
+
/**
|
|
1089
|
+
* A list of web component tag names that are directly referenced in a Stencil component's JSX/h() function
|
|
1090
|
+
*/
|
|
1091
|
+
directDependencies: string[];
|
|
1092
|
+
/**
|
|
1093
|
+
* A list of web component tag names that the current component directly in their JSX/h() function
|
|
1094
|
+
*/
|
|
1095
|
+
directDependents: string[];
|
|
1096
|
+
docs: CompilerJsDoc;
|
|
1097
|
+
doesExtend: boolean;
|
|
1098
|
+
elementRef: string;
|
|
1099
|
+
encapsulation: Encapsulation;
|
|
1100
|
+
events: ComponentCompilerEvent[];
|
|
1101
|
+
excludeFromCollection: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Whether or not the component is form-associated
|
|
1104
|
+
*/
|
|
1105
|
+
formAssociated: boolean;
|
|
1106
|
+
internal: boolean;
|
|
1107
|
+
isCollectionDependency: boolean;
|
|
1108
|
+
jsFilePath: string;
|
|
1109
|
+
listeners: ComponentCompilerListener[];
|
|
1110
|
+
methods: ComponentCompilerMethod[];
|
|
1111
|
+
properties: ComponentCompilerProperty[];
|
|
1112
|
+
serializers: ComponentCompilerChangeHandler[];
|
|
1113
|
+
shadowDelegatesFocus: boolean;
|
|
1114
|
+
/**
|
|
1115
|
+
* Whether the shadow root is preserved when the host element is deep-cloned via
|
|
1116
|
+
* `Node.cloneNode(true)`. Only applicable when encapsulation is 'shadow'.
|
|
1117
|
+
*/
|
|
1118
|
+
shadowClonable: boolean;
|
|
1119
|
+
/**
|
|
1120
|
+
* Whether the shadow root is marked serializable for `Element.getHTML({ serializableShadowRoots: true })`.
|
|
1121
|
+
* Only applicable when encapsulation is 'shadow'.
|
|
1122
|
+
*/
|
|
1123
|
+
shadowSerializable: boolean;
|
|
1124
|
+
/**
|
|
1125
|
+
* Shadow DOM mode. 'open' (default) or 'closed'.
|
|
1126
|
+
* Only applicable when encapsulation is 'shadow'.
|
|
1127
|
+
*/
|
|
1128
|
+
shadowMode: 'open' | 'closed' | null;
|
|
1129
|
+
/**
|
|
1130
|
+
* Slot assignment mode for shadow DOM. 'manual', enables imperative slotting
|
|
1131
|
+
* using HTMLSlotElement.assign(). Only applicable when encapsulation is 'shadow'.
|
|
1132
|
+
*/
|
|
1133
|
+
slotAssignment: 'manual' | null;
|
|
1134
|
+
/**
|
|
1135
|
+
* Per-component slot patches for non-shadow DOM components.
|
|
1136
|
+
* These patches enable proper slot behavior without native Shadow DOM.
|
|
1137
|
+
* Only applicable when encapsulation is 'none' or 'scoped'.
|
|
1138
|
+
*/
|
|
1139
|
+
patches: ComponentPatches | null;
|
|
1140
|
+
sourceFilePath: string;
|
|
1141
|
+
sourceMapPath: string;
|
|
1142
|
+
states: ComponentCompilerState[];
|
|
1143
|
+
styleDocs: CompilerStyleDoc[];
|
|
1144
|
+
styles: StyleCompiler[];
|
|
1145
|
+
globalStyles: ComponentGlobalStyle[];
|
|
1146
|
+
tagName: string;
|
|
1147
|
+
virtualProperties: ComponentCompilerVirtualProperty[];
|
|
1148
|
+
watchers: ComponentCompilerChangeHandler[];
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* The supported style encapsulation modes on a Stencil component:
|
|
1152
|
+
* 1. 'shadow' - native Shadow DOM
|
|
1153
|
+
* 2. 'scoped' - encapsulated styles and polyfilled slots
|
|
1154
|
+
* 3. 'none' - a basic HTML element
|
|
1155
|
+
*/
|
|
1156
|
+
type Encapsulation = 'shadow' | 'scoped' | 'none';
|
|
1157
|
+
/**
|
|
1158
|
+
* Per-component slot patches for non-shadow DOM components.
|
|
1159
|
+
* These enable proper slot behavior when not using native Shadow DOM.
|
|
1160
|
+
*/
|
|
1161
|
+
interface ComponentPatches {
|
|
1162
|
+
/** Apply all slot patches (equivalent to lightDomPatches) */
|
|
1163
|
+
all?: boolean;
|
|
1164
|
+
/** Patch child node accessors (children, firstChild, lastChild, etc.) */
|
|
1165
|
+
children?: boolean;
|
|
1166
|
+
/** Patch cloneNode() to handle slotted content */
|
|
1167
|
+
clone?: boolean;
|
|
1168
|
+
/** Patch appendChild(), insertBefore(), etc. for slot relocation */
|
|
1169
|
+
insert?: boolean;
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Intermediate Representation (IR) of a static property on a Stencil component
|
|
1173
|
+
*/
|
|
1174
|
+
interface ComponentCompilerStaticProperty {
|
|
1175
|
+
mutable: boolean;
|
|
1176
|
+
optional: boolean;
|
|
1177
|
+
required: boolean;
|
|
1178
|
+
type: ComponentCompilerPropertyType;
|
|
1179
|
+
complexType: ComponentCompilerPropertyComplexType;
|
|
1180
|
+
attribute?: string;
|
|
1181
|
+
reflect?: boolean;
|
|
1182
|
+
docs: CompilerJsDoc;
|
|
1183
|
+
defaultValue?: string;
|
|
1184
|
+
getter: boolean;
|
|
1185
|
+
setter: boolean;
|
|
1186
|
+
ogPropName?: string;
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Intermediate Representation (IR) of a property on a Stencil component
|
|
1190
|
+
*/
|
|
1191
|
+
interface ComponentCompilerProperty extends ComponentCompilerStaticProperty {
|
|
1192
|
+
name: string;
|
|
1193
|
+
internal: boolean;
|
|
1194
|
+
}
|
|
1195
|
+
interface ComponentCompilerVirtualProperty {
|
|
1196
|
+
name: string;
|
|
1197
|
+
type: string;
|
|
1198
|
+
docs: string;
|
|
1199
|
+
}
|
|
1200
|
+
type ComponentCompilerPropertyType = 'any' | 'string' | 'boolean' | 'number' | 'unknown';
|
|
1201
|
+
/**
|
|
1202
|
+
* Information about a type used in a Stencil component or exported
|
|
1203
|
+
* from a Stencil project.
|
|
1204
|
+
*/
|
|
1205
|
+
interface ComponentCompilerPropertyComplexType {
|
|
1206
|
+
/**
|
|
1207
|
+
* The string of the original type annotation in the Stencil source code
|
|
1208
|
+
*/
|
|
1209
|
+
original: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* A 'resolved' type, where e.g. imported types have been resolved and inlined
|
|
1212
|
+
*
|
|
1213
|
+
* For instance, an annotation like `(foo: Foo) => string;` will be
|
|
1214
|
+
* converted to `(foo: { foo: string }) => string;`.
|
|
1215
|
+
*/
|
|
1216
|
+
resolved: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* A record of the types which were referenced in the assorted type
|
|
1219
|
+
* annotation in the original source file.
|
|
1220
|
+
*/
|
|
1221
|
+
references: ComponentCompilerTypeReferences;
|
|
1222
|
+
/**
|
|
1223
|
+
* @internal TypeScript AST node used for semantic type analysis during compilation.
|
|
1224
|
+
* Not serialized, only used internally for improved type renaming logic.
|
|
1225
|
+
*/
|
|
1226
|
+
_astNode?: any;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* A record of `ComponentCompilerTypeReference` entities.
|
|
1230
|
+
*
|
|
1231
|
+
* Each key in this record is intended to be the names of the types used by a component. However, this is not enforced
|
|
1232
|
+
* by the type system (I.E. any string can be used as a key).
|
|
1233
|
+
*
|
|
1234
|
+
* Note any key can be a user defined type or a TypeScript standard type.
|
|
1235
|
+
*/
|
|
1236
|
+
type ComponentCompilerTypeReferences = Record<string, ComponentCompilerTypeReference>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Describes a reference to a type used by a component.
|
|
1239
|
+
*/
|
|
1240
|
+
interface ComponentCompilerTypeReference {
|
|
1241
|
+
/**
|
|
1242
|
+
* A type may be defined:
|
|
1243
|
+
* - locally (in the same file as the component that uses it)
|
|
1244
|
+
* - globally
|
|
1245
|
+
* - by importing it into a file (and is defined elsewhere)
|
|
1246
|
+
*/
|
|
1247
|
+
location: 'local' | 'global' | 'import';
|
|
1248
|
+
/**
|
|
1249
|
+
* The path to the type reference, if applicable (global types should not need a path associated with them)
|
|
1250
|
+
*/
|
|
1251
|
+
path?: string;
|
|
1252
|
+
/**
|
|
1253
|
+
* An ID for this type which is unique within a Stencil project.
|
|
1254
|
+
*/
|
|
1255
|
+
id: string;
|
|
1256
|
+
/**
|
|
1257
|
+
* Whether this type was imported as a default import (e.g., `import MyEnum from './my-enum'`)
|
|
1258
|
+
* vs a named import (e.g., `import { MyType } from './my-type'`)
|
|
1259
|
+
*/
|
|
1260
|
+
isDefault?: boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* The name used in the import statement (before any user-defined alias).
|
|
1263
|
+
* For `import { XAxisOption as moo }`, this would be "XAxisOption".
|
|
1264
|
+
* This is the name exported by the source module.
|
|
1265
|
+
*/
|
|
1266
|
+
referenceLocation?: string;
|
|
1267
|
+
}
|
|
1268
|
+
interface ComponentCompilerStaticEvent {
|
|
1269
|
+
name: string;
|
|
1270
|
+
method: string;
|
|
1271
|
+
bubbles: boolean;
|
|
1272
|
+
cancelable: boolean;
|
|
1273
|
+
composed: boolean;
|
|
1274
|
+
docs: CompilerJsDoc;
|
|
1275
|
+
complexType: ComponentCompilerEventComplexType;
|
|
1276
|
+
}
|
|
1277
|
+
interface ComponentCompilerEvent extends ComponentCompilerStaticEvent {
|
|
1278
|
+
internal: boolean;
|
|
1279
|
+
}
|
|
1280
|
+
interface ComponentCompilerEventComplexType {
|
|
1281
|
+
original: string;
|
|
1282
|
+
resolved: string;
|
|
1283
|
+
references: ComponentCompilerTypeReferences;
|
|
1284
|
+
}
|
|
1285
|
+
interface ComponentCompilerListener {
|
|
1286
|
+
name: string;
|
|
1287
|
+
method: string;
|
|
1288
|
+
capture: boolean;
|
|
1289
|
+
passive: boolean;
|
|
1290
|
+
target: ListenTargetOptions | undefined;
|
|
1291
|
+
}
|
|
1292
|
+
interface ComponentCompilerStaticMethod {
|
|
1293
|
+
docs: CompilerJsDoc;
|
|
1294
|
+
complexType: ComponentCompilerMethodComplexType;
|
|
1295
|
+
}
|
|
1296
|
+
interface ComponentCompilerMethodComplexType {
|
|
1297
|
+
signature: string;
|
|
1298
|
+
parameters: JsonDocMethodParameter[];
|
|
1299
|
+
references: ComponentCompilerTypeReferences;
|
|
1300
|
+
return: string;
|
|
1301
|
+
/**
|
|
1302
|
+
* @internal TypeScript AST method node used for semantic type analysis during compilation.
|
|
1303
|
+
* Not serialized, only used internally for improved type renaming logic.
|
|
1304
|
+
*/
|
|
1305
|
+
_astNode?: any;
|
|
1306
|
+
}
|
|
1307
|
+
interface ComponentCompilerChangeHandler {
|
|
1308
|
+
propName: string;
|
|
1309
|
+
methodName: string;
|
|
1310
|
+
handlerOptions?: {
|
|
1311
|
+
immediate?: boolean;
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
interface ComponentCompilerMethod extends ComponentCompilerStaticMethod {
|
|
1315
|
+
name: string;
|
|
1316
|
+
internal: boolean;
|
|
1317
|
+
}
|
|
1318
|
+
interface ComponentCompilerState {
|
|
1319
|
+
name: string;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Metadata about a custom state defined via @AttachInternals({ states: {...} })
|
|
1323
|
+
*
|
|
1324
|
+
* Custom states are exposed via the ElementInternals.states CustomStateSet
|
|
1325
|
+
* and can be targeted with the CSS :state() pseudo-class.
|
|
1326
|
+
*/
|
|
1327
|
+
interface ComponentCompilerCustomState {
|
|
1328
|
+
/**
|
|
1329
|
+
* The name of the custom state (without dashes)
|
|
1330
|
+
*/
|
|
1331
|
+
name: string;
|
|
1332
|
+
/**
|
|
1333
|
+
* The initial value of the state
|
|
1334
|
+
*/
|
|
1335
|
+
initialValue: boolean;
|
|
1336
|
+
/**
|
|
1337
|
+
* Optional JSDoc description for the state
|
|
1338
|
+
*/
|
|
1339
|
+
docs: string;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Representation of JSDoc that is pulled off a node in the AST
|
|
1343
|
+
*/
|
|
1344
|
+
interface CompilerJsDoc {
|
|
1345
|
+
/**
|
|
1346
|
+
* The text associated with the JSDoc
|
|
1347
|
+
*/
|
|
1348
|
+
text: string;
|
|
1349
|
+
/**
|
|
1350
|
+
* Tags included in the JSDoc
|
|
1351
|
+
*/
|
|
1352
|
+
tags: CompilerJsDocTagInfo[];
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Representation of a tag that exists in a JSDoc
|
|
1356
|
+
*/
|
|
1357
|
+
interface CompilerJsDocTagInfo {
|
|
1358
|
+
/**
|
|
1359
|
+
* The name of the tag - e.g. `@deprecated`
|
|
1360
|
+
*/
|
|
1361
|
+
name: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
|
|
1364
|
+
*/
|
|
1365
|
+
text?: string;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
|
|
1369
|
+
* the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
|
|
1370
|
+
*/
|
|
1371
|
+
interface CompilerStyleDoc {
|
|
1372
|
+
/**
|
|
1373
|
+
* The name of the CSS property
|
|
1374
|
+
*/
|
|
1375
|
+
name: string;
|
|
1376
|
+
/**
|
|
1377
|
+
* The user-defined description of the CSS property
|
|
1378
|
+
*/
|
|
1379
|
+
docs: string;
|
|
1380
|
+
/**
|
|
1381
|
+
* The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
|
|
1382
|
+
* Used to inform Stencil where the start of a new property's description starts (and where the previous description
|
|
1383
|
+
* ends).
|
|
1384
|
+
*/
|
|
1385
|
+
annotation: 'prop';
|
|
1386
|
+
/**
|
|
1387
|
+
* The Stencil style-mode that is associated with this property.
|
|
1388
|
+
*/
|
|
1389
|
+
mode: string;
|
|
1390
|
+
}
|
|
1391
|
+
interface CompilerAssetDir {
|
|
1392
|
+
absolutePath?: string;
|
|
1393
|
+
cmpRelativePath?: string;
|
|
1394
|
+
originalComponentPath?: string;
|
|
1395
|
+
}
|
|
1396
|
+
interface StyleCompiler {
|
|
1397
|
+
modeName: string;
|
|
1398
|
+
styleId: string;
|
|
1399
|
+
styleStr: string;
|
|
1400
|
+
styleIdentifier: string;
|
|
1401
|
+
externalStyles: ExternalStyleCompiler[];
|
|
1402
|
+
}
|
|
1403
|
+
interface ExternalStyleCompiler {
|
|
1404
|
+
absolutePath: string;
|
|
1405
|
+
relativePath: string;
|
|
1406
|
+
originalComponentPath: string;
|
|
1407
|
+
}
|
|
1408
|
+
interface ComponentGlobalStyle {
|
|
1409
|
+
/** Absolute path to the CSS file, or null for inline styles */
|
|
1410
|
+
absolutePath: string | null;
|
|
1411
|
+
/** Raw inline CSS string, or null for file-based styles */
|
|
1412
|
+
styleStr: string | null;
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* A record of `TypesMemberNameData` entities.
|
|
1416
|
+
*
|
|
1417
|
+
* Each key in this record is intended to be the path to a file that declares one or more types used by a component.
|
|
1418
|
+
* However, this is not enforced by the type system - users of this interface should not make any assumptions regarding
|
|
1419
|
+
* the format of the path used as a key (relative vs. absolute)
|
|
1420
|
+
*/
|
|
1421
|
+
interface TypesImportData {
|
|
1422
|
+
[key: string]: TypesMemberNameData[];
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* A type describing how Stencil may alias an imported type to avoid naming collisions when performing operations such
|
|
1426
|
+
* as generating `components.d.ts` files.
|
|
1427
|
+
*/
|
|
1428
|
+
interface TypesMemberNameData {
|
|
1429
|
+
/**
|
|
1430
|
+
* The original name of the import before any aliasing was applied.
|
|
1431
|
+
*
|
|
1432
|
+
* i.e. if a component imports a type as follows:
|
|
1433
|
+
* `import { MyType as MyCoolType } from './my-type';`
|
|
1434
|
+
*
|
|
1435
|
+
* the `originalName` would be 'MyType'. If the import is not aliased, then `originalName` and `localName` will be the same.
|
|
1436
|
+
*/
|
|
1437
|
+
originalName: string;
|
|
1438
|
+
/**
|
|
1439
|
+
* The name of the type as it's used within a file.
|
|
1440
|
+
*/
|
|
1441
|
+
localName: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* An alias that Stencil may apply to the `localName` to avoid naming collisions. This name does not appear in the
|
|
1444
|
+
* file that is using `localName`.
|
|
1445
|
+
*/
|
|
1446
|
+
importName?: string;
|
|
1447
|
+
/**
|
|
1448
|
+
* Whether this is a default import/export (e.g., `import MyEnum from './my-enum'`)
|
|
1449
|
+
* vs a named import/export (e.g., `import { MyType } from './my-type'`)
|
|
1450
|
+
*/
|
|
1451
|
+
isDefault?: boolean;
|
|
1452
|
+
}
|
|
1453
|
+
interface TypesModule {
|
|
1454
|
+
isDep: boolean;
|
|
1455
|
+
tagName: string;
|
|
1456
|
+
tagNameAsPascal: string;
|
|
1457
|
+
htmlElementName: string;
|
|
1458
|
+
component: string;
|
|
1459
|
+
jsx: string;
|
|
1460
|
+
element: string;
|
|
1461
|
+
explicitAttributes: string | null;
|
|
1462
|
+
explicitProperties: string | null;
|
|
1463
|
+
requiredProps: Array<{
|
|
1464
|
+
name: string;
|
|
1465
|
+
type: string;
|
|
1466
|
+
complexType?: ComponentCompilerProperty['complexType'];
|
|
1467
|
+
}> | null;
|
|
1468
|
+
}
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/compiler/sys/stencil-sys.d.ts
|
|
1471
|
+
/**
|
|
1472
|
+
* Create an in-memory `CompilerSystem` object, optionally using a supplied
|
|
1473
|
+
* logger instance
|
|
1474
|
+
*
|
|
1475
|
+
* This particular system being an 'in-memory' `CompilerSystem` is intended for
|
|
1476
|
+
* use in the browser. In most cases, for instance when using Stencil through
|
|
1477
|
+
* the CLI, a Node.js-specific `CompilerSystem` will be used instead. See
|
|
1478
|
+
* {@link CompilerSystem} for more details.
|
|
1479
|
+
*
|
|
1480
|
+
* @param c an object wrapping a logger instance
|
|
1481
|
+
* @returns a complete CompilerSystem, ready for use!
|
|
1482
|
+
*/
|
|
1483
|
+
declare const createSystem: (c?: {
|
|
1484
|
+
logger?: Logger;
|
|
1485
|
+
}) => CompilerSystem;
|
|
1486
|
+
//#endregion
|
|
1487
|
+
//#region src/utils/shadow-css.d.ts
|
|
1488
|
+
declare const scopeCss: (cssText: string, scopeId: string, commentOriginalSelector: boolean) => string;
|
|
1489
|
+
//#endregion
|
|
1490
|
+
//#region src/compiler/transpile.d.ts
|
|
1491
|
+
/**
|
|
1492
|
+
* The `transpile()` function inputs source code as a string, with various options
|
|
1493
|
+
* within the second argument. The function is stateless and returns a `Promise` of the
|
|
1494
|
+
* results, including diagnostics and the transpiled code. The `transpile()` function
|
|
1495
|
+
* does not handle any bundling, minifying, or precompiling any CSS preprocessing like
|
|
1496
|
+
* Sass or Less. The `transpileSync()` equivalent is available so the same function
|
|
1497
|
+
* it can be called synchronously. However, TypeScript must be already loaded within
|
|
1498
|
+
* the global for it to work, where as the async `transpile()` function will load
|
|
1499
|
+
* TypeScript automatically.
|
|
1500
|
+
*
|
|
1501
|
+
* Since TypeScript is used, the source code will transpile from TypeScript to JavaScript,
|
|
1502
|
+
* and does not require Babel presets. Additionally, the results includes an `imports`
|
|
1503
|
+
* array of all the import paths found in the source file. The transpile options can be
|
|
1504
|
+
* used to set the `module` format, such as `cjs`, and JavaScript `target` version, such
|
|
1505
|
+
* as `es2017`.
|
|
1506
|
+
*
|
|
1507
|
+
* @param code the code to transpile
|
|
1508
|
+
* @param opts options for the transpilation process
|
|
1509
|
+
* @returns a Promise wrapping the results of the transpilation
|
|
1510
|
+
*/
|
|
1511
|
+
declare const transpile: (code: string, opts?: TranspileOptions) => Promise<TranspileResults>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Synchronous equivalent of the `transpile()` function. When used in a browser
|
|
1514
|
+
* environment, TypeScript must already be available globally, where as the async
|
|
1515
|
+
* `transpile()` function will load TypeScript automatically.
|
|
1516
|
+
*
|
|
1517
|
+
* @param code the code to transpile
|
|
1518
|
+
* @param opts options for the transpilation process
|
|
1519
|
+
* @returns the results of the transpilation
|
|
1520
|
+
*/
|
|
1521
|
+
declare const transpileSync: (code: string, opts?: TranspileOptions) => TranspileResults;
|
|
1522
|
+
//#endregion
|
|
1523
|
+
//#region src/compiler/types/generate-component-types.d.ts
|
|
1524
|
+
/**
|
|
1525
|
+
* Generate a string based on the types that are defined within a component
|
|
1526
|
+
* @param cmp the metadata for the component that a type definition string is generated for
|
|
1527
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
1528
|
+
* @param areTypesInternal `true` if types being generated are for a project's internal purposes, `false` otherwise
|
|
1529
|
+
* @param signalBacking `true` if the component is using signal backing for its props; includes the signals map on the element interface
|
|
1530
|
+
* @returns the generated types string alongside additional metadata
|
|
1531
|
+
*/
|
|
1532
|
+
declare const generateComponentTypes: (cmp: ComponentCompilerMeta, typeImportData: TypesImportData, areTypesInternal: boolean, signalBacking?: boolean) => TypesModule;
|
|
1533
|
+
//#endregion
|
|
1534
|
+
export { type BuildOverrides, type CompilerSystem, type Diagnostic, type Logger, type TranspileOptions, type TranspileResults, createSystem, generateComponentTypes, scopeCss, transpile, transpileSync, ts };
|