@stencil/core 5.0.0-next.0 → 5.0.0-rc.1

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