@stencil/core 5.0.0-alpha.1 → 5.0.0-alpha.10

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 (50) hide show
  1. package/dist/app-data/index.d.ts +2 -0
  2. package/dist/{runtime/app-data → app-data}/index.js +17 -12
  3. package/dist/{client-B1nuvCd2.mjs → client-aTQ7xHxx.mjs} +2432 -2278
  4. package/dist/compiler/index.d.mts +6 -6
  5. package/dist/compiler/index.mjs +2 -2
  6. package/dist/compiler/utils/index.d.mts +2 -2
  7. package/dist/compiler/utils/index.mjs +3 -3
  8. package/dist/{compiler-LX4_RKKd.mjs → compiler-lTINDSgw.mjs} +14854 -13500
  9. package/dist/declarations/stencil-public-compiler.d.ts +4374 -2
  10. package/dist/declarations/stencil-public-compiler.js +2 -4
  11. package/dist/declarations/stencil-public-docs.d.ts +504 -1
  12. package/dist/declarations/stencil-public-runtime.d.ts +1982 -2
  13. package/dist/{index-fIuYTL9f.d.mts → index-BvkyxSY6.d.mts} +29 -2
  14. package/dist/{index-D-LlB2nw.d.mts → index-vY35H18z.d.mts} +795 -1188
  15. package/dist/{index-BONzXKJt.d.ts → index-xAkMgLX_.d.ts} +88 -39
  16. package/dist/index.d.mts +1 -1
  17. package/dist/index.mjs +2 -2
  18. package/dist/jsx-runtime.d.mts +18 -0
  19. package/dist/jsx-runtime.mjs +2 -0
  20. package/dist/{node-SxQIOCZE.mjs → node--akYC-sG.mjs} +20 -30
  21. package/dist/regular-expression-CFVJOTUh.mjs +508 -0
  22. package/dist/{runtime-CF9DJtSu.js → runtime/client/lazy.js} +2675 -2493
  23. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +106 -78
  24. package/dist/runtime/client/{index.js → runtime.js} +2545 -2487
  25. package/dist/runtime/index.d.ts +58 -29
  26. package/dist/runtime/index.js +4795 -2
  27. package/dist/runtime/server/index.d.mts +103 -70
  28. package/dist/runtime/server/index.mjs +2545 -2350
  29. package/dist/runtime/server/runner.d.mts +44 -48
  30. package/dist/runtime/server/runner.mjs +347 -751
  31. package/dist/signals/index.d.ts +47 -0
  32. package/dist/signals/index.js +199 -0
  33. package/dist/sys/node/index.d.mts +1 -1
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.mjs +2 -2
  36. package/dist/testing/index.d.mts +97 -3
  37. package/dist/testing/index.mjs +367 -59
  38. package/dist/{validation-CaCgjw-f.mjs → validation-ByxKj8bC.mjs} +116 -99
  39. package/package.json +47 -38
  40. package/dist/index-CHjZtib0.d.ts +0 -30
  41. package/dist/jsx-runtime-DBzBJLKk.d.ts +0 -28
  42. package/dist/jsx-runtime.d.ts +0 -2
  43. package/dist/jsx-runtime.js +0 -2
  44. package/dist/runtime/app-data/index.d.ts +0 -2
  45. package/dist/serialize-BkYHk7Mi.mjs +0 -766
  46. package/dist/stencil-public-compiler-C_X1iolo.d.ts +0 -4455
  47. package/dist/stencil-public-runtime-DlV8o7-z.d.ts +0 -1845
  48. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
  49. /package/dist/{runtime/app-globals → app-globals}/index.js +0 -0
  50. /package/dist/{chunk-CjcI7cDX.mjs → chunk-z9aeyW2b.mjs} +0 -0
@@ -1,2 +1,4374 @@
1
- import { $ as CustomElementsExportBehavior, $n as JsonDocsValue, $t as PageReloadStrategy, A as CompilerFileWatcher, An as TranspileOptions, At as OptimizeJsInput, B as CompilerSystemRemoveDirectoryOptions, Bn as JsonDocsCustomState, Bt as OutputTargetDistCustomElements, C as CompilerEventDirAdd, Cn as SystemDetails, Ct as Logger, D as CompilerEventFileUpdate, Dn as TransformOptions, Dt as NodeResolveConfig, E as CompilerEventFileDelete, En as TestingRunOptions, Et as MakeDirectoryOptions, F as CompilerRequestResponse, Fn as WorkerMainController, Ft as OutputTargetBuild, G as CompilerSystemWriteFileResults, Gn as JsonDocsMethodReturn, Gt as OutputTargetDocsCustom, H as CompilerSystemRemoveFileResults, Hn as JsonDocsEvent, Ht as OutputTargetDistLazy, I as CompilerSystem, In as WorkerOptions, It as OutputTargetCopy, J as ConfigBundle, Jn as JsonDocsSlot, Jt as OutputTargetDocsReadme, K as CompilerWatcher, Kn as JsonDocsPart, Kt as OutputTargetDocsCustomElementsManifest, L as CompilerSystemCreateDirectoryOptions, Ln as JsonDocMethodParameter, Lt as OutputTargetCustom, M as CompilerFileWatcherEvent, Mn as UnvalidatedConfig, Mt as OutputTarget, N as CompilerFsStats, Nn as ValidatedConfig, Nt as OutputTargetBase, O as CompilerEventFsChange, On as TransformerConfig, Ot as OptimizeCssInput, P as CompilerRequest, Pn as WatcherCloseResults, Pt as OutputTargetBaseNext, Q as Credentials, Qn as JsonDocsUsage, Qt as OutputTargetWww, R as CompilerSystemCreateDirectoryResults, Rn as JsonDocs, Rt as OutputTargetDist, S as CompilerEventBuildStart, Sn as StencilDocsConfig, St as LogLevel, T as CompilerEventFileAdd, Tn as TestingConfig, Tt as LoggerTimeSpan, U as CompilerSystemRenameResults, Un as JsonDocsListener, Ut as OutputTargetDistLazyLoader, V as CompilerSystemRemoveDirectoryResults, Vn as JsonDocsDependencyGraph, Vt as OutputTargetDistGlobalStyles, W as CompilerSystemRenamedPath, Wn as JsonDocsMethod, Wt as OutputTargetDistTypes, X as CopyResults, Xn as JsonDocsTag, Xt as OutputTargetHydrate, Y as ConfigExtras, Yn as JsonDocsStyle, Yt as OutputTargetDocsVscode, Z as CopyTask, Zn as JsonDocsTypeLibrary, Zt as OutputTargetStats, _ as CompilerBuildStart, _n as ServiceWorkerConfig, _t as JestConfig, a as BuildNoChangeResults, an as PrerenderResults, at as EligiblePrimaryPackageOutputTarget, b as CompilerEventBuildLog, bn as StencilConfig, bt as LoadConfigInit, c as BuildOutput, cn as ResolveModuleIdResults, ct as FsStats, d as CacheStorage, dn as RobotsTxtResults, dt as HistoryApiFallback, en as ParsedPath, er as StyleDoc, et as CustomElementsExportBehaviorOptions, f as CliInitOptions, fn as RollupConfig, ft as HmrStyleUpdate, g as CompilerBuildResults, gn as SerializeDocumentOptions, gt as HydratedFlag, h as Compiler, hn as RollupOutputOptions, ht as HydrateFactoryOptions, i as BuildLog, in as PrerenderHydrateOptions, it as Diagnostic, j as CompilerFileWatcherCallback, jn as TranspileResults, jt as OptimizeJsOutput, k as CompilerEventName, kn as TranspileOnlyResults, kt as OptimizeCssOutput, l as BuildResultsComponentGraph, ln as ResolveModuleOptions, lt as FsWatchResults, m as CompileTarget, mn as RollupInterface, mt as HydrateDocumentOptions, n as BuildEmitEvents, nn as PlatformPath, nt as DevServerConfig, o as BuildOnEventRemove, on as PrerenderStartOptions, ot as EmulateConfig, p as CompileScriptMinifyOptions, pn as RollupInputOptions, pt as HotModuleReplacement, q as Config, qn as JsonDocsProp, qt as OutputTargetDocsJson, r as BuildEvents, rn as PrerenderConfig, rt as DevServerEditor, s as BuildOnEvents, sn as ResolveModuleIdOptions, st as EmulateViewport, t as AutoprefixerOptions, tn as Path, tt as DevServer, u as BundlingConfig, un as RobotsTxtOpts, ut as FsWatcherItem, v as CompilerDependency, vn as SitemapXmpOpts, vt as LOG_LEVELS, w as CompilerEventDirDelete, wn as Testing, wt as LoggerLineUpdater, x as CompilerEventBuildNoChange, xn as StencilDevServerConfig, xt as LoadConfigResults, y as CompilerEventBuildFinish, yn as SitemapXmpResults, yt as LazyRequire, z as CompilerSystemRealpathResults, zn as JsonDocsComponent, zt as OutputTargetDistCollection } from "../stencil-public-compiler-C_X1iolo.js";
2
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, BundlingConfig, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, EligiblePrimaryPackageOutputTarget, EmulateConfig, EmulateViewport, FsStats, FsWatchResults, FsWatcherItem, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JestConfig, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, MakeDirectoryOptions, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCopy, OutputTargetCustom, OutputTargetDist, OutputTargetDistCollection, OutputTargetDistCustomElements, OutputTargetDistGlobalStyles, OutputTargetDistLazy, OutputTargetDistLazyLoader, OutputTargetDistTypes, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetHydrate, OutputTargetStats, OutputTargetWww, PageReloadStrategy, ParsedPath, Path, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RollupConfig, RollupInputOptions, RollupInterface, RollupOutputOptions, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, Testing, TestingConfig, TestingRunOptions, TransformOptions, TransformerConfig, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };
1
+ import { ListenTargetOptions, ResolutionHandler } from "./stencil-public-runtime.js";
2
+ import { InputOptions, SourceMap as RolldownSourceMap } from "rolldown";
3
+ //#region src/utils/result.d.ts
4
+ /**
5
+ * A Result wraps up a success state and a failure state, allowing you to
6
+ * return a single type from a function and discriminate between the two
7
+ * possible states in a principled way.
8
+ *
9
+ * Using it could look something like this:
10
+ *
11
+ * ```ts
12
+ * import { result } from './';
13
+ *
14
+ * const mightFail = (input: number): Result<number, string> => {
15
+ * try {
16
+ * let value: number = calculateSomethingWithInput(input);
17
+ * return result.ok(value);
18
+ * } catch (e) {
19
+ * return result.err(e.message);
20
+ * }
21
+ * }
22
+ *
23
+ * const sumResult = mightFail(2);
24
+ *
25
+ * const msg = result.map(sumResult, (sum: number) => `the sum was: ${sum}`);
26
+ * ```
27
+ *
28
+ * A few utility methods are defined in this module, like `map` and `unwrap`,
29
+ * which are (probably obviously) inspired by the correspond methods on
30
+ * `std::result::Result` in Rust.
31
+ */
32
+ type Result<OnSuccess, OnFailure> = Ok<OnSuccess> | Err<OnFailure>;
33
+ /**
34
+ * Type for the Ok state of a Result
35
+ */
36
+ type Ok<T> = {
37
+ isOk: true;
38
+ isErr: false;
39
+ value: T;
40
+ };
41
+ /**
42
+ * Type for the Err state of a Result
43
+ */
44
+ type Err<T> = {
45
+ isOk: false;
46
+ isErr: true;
47
+ value: T;
48
+ };
49
+ /**
50
+ * Create an `Ok` given a value. This doesn't do any checking that the value is
51
+ * 'ok-ish' since doing so would make an undue assumption about what is 'ok'.
52
+ * Instead, this trusts the user to determine, at the call site, whether
53
+ * something is `ok()` or `err()`.
54
+ *
55
+ * @param value the value to wrap up in an `Ok`
56
+ * @returns an Ok wrapping the value
57
+ */
58
+ //#endregion
59
+ //#region src/compiler/sys/in-memory-fs.d.ts
60
+ /**
61
+ * An in-memory FS which proxies the underlying OS filesystem using a simple
62
+ * in-memory cache. FS writes can accumulate on the in-memory system, using an
63
+ * API similar to Node.js' `"fs"` module, and then be committed to disk as a
64
+ * unit.
65
+ *
66
+ * Files written to the in-memory system can be edited, deleted, and so on.
67
+ * This allows the compiler to proceed freely as if it is modifying the
68
+ * filesystem, modifying the world in whatever way suits it, while deferring
69
+ * actual FS writes until the end of the compilation process, making actual
70
+ * changes to the filesystem on disk contingent on an error-free build or any
71
+ * other condition.
72
+ *
73
+ * Usage example:
74
+ *
75
+ * ```ts
76
+ * // create an in-memory FS
77
+ * const sys = createSystem();
78
+ * const inMemoryFs = createInMemoryFs(sys);
79
+ *
80
+ * // do a few fs operations
81
+ * await inMemoryFs.writeFile("path/to/file.js", 'console.log("hey!");')
82
+ * await inMemoryFs.remove("path/to/another_file.ts");
83
+ *
84
+ * // commit the results to disk
85
+ * const commitStats = await inMemoryFs.commit();
86
+ * ```
87
+ *
88
+ * In the above example the write operation and the delete operation (w/
89
+ * `.remove`) are both queued in the in-memory proxy but not committed to
90
+ * disk until the `.commit` method is called.
91
+ */
92
+ type InMemoryFileSystem = ReturnType<typeof createInMemoryFs>;
93
+ /**
94
+ * A node in the in-memory file system. This may represent a file or
95
+ * a directory, and pending copy, write, and delete operations may be stored
96
+ * on it.
97
+ */
98
+ interface FsItem {
99
+ fileText: string;
100
+ isFile: boolean;
101
+ isDirectory: boolean;
102
+ size: number;
103
+ mtimeMs: number;
104
+ exists: boolean;
105
+ queueCopyFileToDest: string;
106
+ queueWriteToDisk: boolean;
107
+ queueDeleteFromDisk?: boolean;
108
+ useCache: boolean;
109
+ }
110
+ /**
111
+ * Options supported by write methods on the in-memory filesystem.
112
+ */
113
+ interface FsWriteOptions {
114
+ /**
115
+ * only use the in-memory cache and do not write the file to disk
116
+ */
117
+ inMemoryOnly?: boolean;
118
+ clearFileCache?: boolean;
119
+ /**
120
+ * flush the write to disk immediately, skipping the in-memory cache
121
+ */
122
+ immediateWrite?: boolean;
123
+ /**
124
+ * specify that the cache should be used
125
+ */
126
+ useCache?: boolean;
127
+ /**
128
+ * An optional tag for the current output target for which this file is being
129
+ * written.
130
+ */
131
+ outputTargetType?: string;
132
+ }
133
+ /**
134
+ * Results from a write operation on the in-memory filesystem.
135
+ */
136
+ interface FsWriteResults {
137
+ changedContent: boolean;
138
+ queuedWrite: boolean;
139
+ ignored: boolean;
140
+ }
141
+ /**
142
+ * Options supported by read methods on the in-memory filesystem.
143
+ */
144
+ interface FsReadOptions {
145
+ useCache?: boolean;
146
+ setHash?: boolean;
147
+ }
148
+ /**
149
+ * Options supported by the readdir option on the in-memory filesystem.
150
+ */
151
+ interface FsReaddirOptions {
152
+ inMemoryOnly?: boolean;
153
+ recursive?: boolean;
154
+ /**
155
+ * Directory names to exclude. Just the basename,
156
+ * not the entire path. Basically for "node_modules".
157
+ */
158
+ excludeDirNames?: string[];
159
+ /**
160
+ * Extensions we know we can avoid. Each extension
161
+ * should include the `.` so that we can test for both
162
+ * `.d.ts.` and `.ts`. If `excludeExtensions` isn't provided it
163
+ * doesn't try to exclude anything. This only checks against
164
+ * the filename, not directory names when recursive.
165
+ */
166
+ excludeExtensions?: string[];
167
+ }
168
+ /**
169
+ * A result from a directory read operation
170
+ */
171
+ interface FsReaddirItem {
172
+ absPath: string;
173
+ relPath: string;
174
+ isDirectory: boolean;
175
+ isFile: boolean;
176
+ }
177
+ /**
178
+ * Information about a file in the in-memory filesystem.
179
+ */
180
+ interface FsStat {
181
+ exists: boolean;
182
+ isFile: boolean;
183
+ isDirectory: boolean;
184
+ size: number;
185
+ }
186
+ /**
187
+ * Create an in-memory FS which proxies the underlying OS filesystem using an
188
+ * in-memory cache. FS writes can accumulate on the in-memory system, using an
189
+ * API similar to Node.js' `"fs"` module, and then be committed to disk as a
190
+ * unit.
191
+ *
192
+ * Files written to the in-memory system can be edited, deleted, and so on.
193
+ * This allows the compiler to proceed freely as if it is modifying the
194
+ * filesystem, modifying the world in whatever way suits it, while deferring
195
+ * actual FS writes until the end of the compilation process, making actual
196
+ * changes to the filesystem on disk contingent on an error-free build or any
197
+ * other condition.
198
+ *
199
+ * @param sys a compiler system object
200
+ * @returns an in-memory filesystem interface
201
+ */
202
+ declare const createInMemoryFs: (sys: CompilerSystem) => {
203
+ access: (filePath: string) => Promise<boolean>;
204
+ accessSync: (filePath: string) => boolean;
205
+ cancelDeleteDirectoriesFromDisk: (dirPaths: string[]) => void;
206
+ cancelDeleteFilesFromDisk: (filePaths: string[]) => void;
207
+ clearCache: () => void;
208
+ clearDirCache: (dirPath: string) => void;
209
+ clearFileCache: (filePath: string) => void;
210
+ commit: () => Promise<FsCommitResults>;
211
+ copyFile: (src: string, dest: string) => Promise<void>;
212
+ emptyDirs: (dirs: string[]) => Promise<void>;
213
+ getBuildOutputs: () => BuildOutput[];
214
+ getItem: (itemPath: string) => FsItem;
215
+ getMemoryStats: () => string;
216
+ readFile: (filePath: string, opts?: FsReadOptions) => Promise<string>;
217
+ readFileSync: (filePath: string, opts?: FsReadOptions) => string;
218
+ readdir: (dirPath: string, opts?: FsReaddirOptions) => Promise<FsReaddirItem[]>;
219
+ remove: (itemPath: string) => Promise<void>;
220
+ stat: (itemPath: string) => Promise<FsStat>;
221
+ statSync: (itemPath: string) => FsStat;
222
+ sys: CompilerSystem;
223
+ writeFile: (filePath: string, content: string, opts?: FsWriteOptions) => Promise<FsWriteResults>;
224
+ writeFiles: (files: {
225
+ [filePath: string]: string;
226
+ } | Map<string, string>, opts?: FsWriteOptions) => Promise<FsWriteResults[]>;
227
+ };
228
+ /**
229
+ * The information needed to carry out a file copy operation.
230
+ *
231
+ * `[ source, destination ]`
232
+ */
233
+ type FileCopyTuple = [string, string];
234
+ /**
235
+ * Collected instructions for all pending filesystem operations saved
236
+ * to the in-memory filesystem.
237
+ */
238
+ /**
239
+ * Results from committing pending filesystem operations
240
+ */
241
+ interface FsCommitResults {
242
+ filesCopied: FileCopyTuple[];
243
+ filesWritten: string[];
244
+ filesDeleted: string[];
245
+ dirsDeleted: string[];
246
+ dirsAdded: string[];
247
+ }
248
+ /**
249
+ * Given the current state of the in-memory proxy filesystem, collect all of
250
+ * the changes that need to be made in order to commit the currently-pending
251
+ * operations (e.g. write, copy, delete) to the OS filesystem.
252
+ *
253
+ * @param items the storage data structure for the in-memory FS cache
254
+ * @returns a collection of all the operations that need to be done
255
+ */
256
+ //#endregion
257
+ //#region src/declarations/stencil-public-docs.d.ts
258
+ /**
259
+ * The Type Library holds information about the types which are used in a
260
+ * Stencil project. During compilation, Stencil gathers information about the
261
+ * types which form part of a component's public API, such as properties
262
+ * decorated with `@Prop`, `@Event`, `@Watch`, etc. This type information is
263
+ * then added to the Type Library, where it can be accessed later on for
264
+ * generating documentation.
265
+ *
266
+ * This information is included in the file written by the `docs-json` output
267
+ * target (see {@link JsonDocs.typeLibrary}).
268
+ */
269
+ type JsonDocsTypeLibrary = Record<string, ComponentCompilerReferencedType>;
270
+ /**
271
+ * A container for JSDoc metadata for a project
272
+ */
273
+ interface JsonDocs {
274
+ /**
275
+ * The metadata for the JSDocs for each component in a Stencil project
276
+ */
277
+ components: JsonDocsComponent[];
278
+ /**
279
+ * The timestamp at which the metadata was generated, in the format YYYY-MM-DDThh:mm:ss
280
+ */
281
+ timestamp: string;
282
+ compiler: {
283
+ /**
284
+ * The name of the compiler that generated the metadata
285
+ */
286
+ name: string;
287
+ /**
288
+ * The version of the Stencil compiler that generated the metadata
289
+ */
290
+ version: string;
291
+ /**
292
+ * The version of TypeScript that was used to generate the metadata
293
+ */
294
+ typescriptVersion: string;
295
+ };
296
+ typeLibrary: JsonDocsTypeLibrary;
297
+ }
298
+ /**
299
+ * Container for JSDoc metadata for a single Stencil component
300
+ */
301
+ interface JsonDocsComponent {
302
+ /**
303
+ * The directory containing the Stencil component, minus the file name.
304
+ *
305
+ * @example /workspaces/stencil-project/src/components/my-component
306
+ */
307
+ dirPath?: string;
308
+ /**
309
+ * The name of the file containing the Stencil component, with no path
310
+ *
311
+ * @example my-component.tsx
312
+ */
313
+ fileName?: string;
314
+ /**
315
+ * The full path of the file containing the Stencil component
316
+ *
317
+ * @example /workspaces/stencil-project/src/components/my-component/my-component.tsx
318
+ */
319
+ filePath?: string;
320
+ /**
321
+ * The path to the component's `readme.md` file, including the filename
322
+ *
323
+ * @example /workspaces/stencil-project/src/components/my-component/readme.md
324
+ */
325
+ readmePath?: string;
326
+ /**
327
+ * The path to the component's `usage` directory
328
+ *
329
+ * @example /workspaces/stencil-project/src/components/my-component/usage/
330
+ */
331
+ usagesDir?: string;
332
+ /**
333
+ * The encapsulation strategy for a component
334
+ */
335
+ encapsulation: 'shadow' | 'scoped' | 'none';
336
+ /**
337
+ * The tag name for the component, for use in HTML
338
+ */
339
+ tag: string;
340
+ /**
341
+ * The contents of a component's `readme.md` that are user generated.
342
+ *
343
+ * Auto-generated contents are not stored in this reference.
344
+ */
345
+ readme: string;
346
+ /**
347
+ * The description of a Stencil component, found in the JSDoc that sits above the component's declaration
348
+ */
349
+ docs: string;
350
+ /**
351
+ * JSDoc tags found in the JSDoc comment written atop a component's declaration
352
+ */
353
+ docsTags: JsonDocsTag[];
354
+ /**
355
+ * The text from the class-level JSDoc for a Stencil component, if present.
356
+ */
357
+ overview?: string;
358
+ /**
359
+ * A mapping of usage example file names to their contents for the component.
360
+ */
361
+ usage: JsonDocsUsage;
362
+ /**
363
+ * Array of metadata for a component's `@Prop`s
364
+ */
365
+ props: JsonDocsProp[];
366
+ /**
367
+ * Array of metadata for a component's `@Method`s
368
+ */
369
+ methods: JsonDocsMethod[];
370
+ /**
371
+ * Array of metadata for a component's `@Event`s
372
+ */
373
+ events: JsonDocsEvent[];
374
+ /**
375
+ * Array of metadata for a component's `@Listen` handlers
376
+ */
377
+ listeners: JsonDocsListener[];
378
+ /**
379
+ * Array of metadata for a component's CSS styling information
380
+ */
381
+ styles: JsonDocsStyle[];
382
+ /**
383
+ * Array of component Slot information, generated from `@slot` tags
384
+ */
385
+ slots: JsonDocsSlot[];
386
+ /**
387
+ * Array of component Parts information, generate from `@part` tags
388
+ */
389
+ parts: JsonDocsPart[];
390
+ /**
391
+ * Array of custom states defined via @AttachInternals({ states: {...} })
392
+ */
393
+ customStates: JsonDocsCustomState[];
394
+ /**
395
+ * Array of metadata describing where the current component is used
396
+ */
397
+ dependents: string[];
398
+ /**
399
+ * Array of metadata listing the components which are used in current component
400
+ */
401
+ dependencies: string[];
402
+ /**
403
+ * Describes a tree of components coupling
404
+ */
405
+ dependencyGraph: JsonDocsDependencyGraph;
406
+ /**
407
+ * A deprecation reason/description found following a `@deprecated` tag
408
+ */
409
+ deprecation?: string;
410
+ }
411
+ interface JsonDocsDependencyGraph {
412
+ [tagName: string]: string[];
413
+ }
414
+ /**
415
+ * A descriptor for a single JSDoc tag found in a block comment
416
+ */
417
+ interface JsonDocsTag {
418
+ /**
419
+ * The tag name (immediately following the '@')
420
+ */
421
+ name: string;
422
+ /**
423
+ * The description that immediately follows the tag name
424
+ */
425
+ text?: string;
426
+ }
427
+ interface JsonDocsValue {
428
+ value?: string;
429
+ type: string;
430
+ }
431
+ /**
432
+ * A mapping of file names to their contents.
433
+ *
434
+ * This type is meant to be used when reading one or more usage markdown files associated with a component. For the
435
+ * given directory structure:
436
+ * ```
437
+ * src/components/my-component
438
+ * ├── my-component.tsx
439
+ * └── usage
440
+ * ├── bar.md
441
+ * └── foo.md
442
+ * ```
443
+ * an instance of this type would include the name of the markdown file, mapped to its contents:
444
+ * ```ts
445
+ * {
446
+ * 'bar': STRING_CONTENTS_OF_BAR.MD
447
+ * 'foo': STRING_CONTENTS_OF_FOO.MD
448
+ * }
449
+ * ```
450
+ */
451
+ interface JsonDocsUsage {
452
+ [key: string]: string;
453
+ }
454
+ /**
455
+ * An intermediate representation of a `@Prop` decorated member's JSDoc
456
+ */
457
+ interface JsonDocsProp {
458
+ /**
459
+ * the name of the prop
460
+ */
461
+ name: string;
462
+ complexType?: ComponentCompilerPropertyComplexType;
463
+ /**
464
+ * the type of the prop, in terms of the TypeScript type system (as opposed to JavaScript's or HTML's)
465
+ */
466
+ type: string;
467
+ /**
468
+ * `true` if the prop was configured as "mutable" where it was declared, `false` otherwise
469
+ */
470
+ mutable: boolean;
471
+ /**
472
+ * The name of the attribute that is exposed to configure a compiled web component
473
+ */
474
+ attr?: string;
475
+ /**
476
+ * `true` if the prop was configured to "reflect" back to HTML where it (the prop) was declared, `false` otherwise
477
+ */
478
+ reflectToAttr: boolean;
479
+ /**
480
+ * the JSDoc description text associated with the prop
481
+ */
482
+ docs: string;
483
+ /**
484
+ * JSDoc tags associated with the prop
485
+ */
486
+ docsTags: JsonDocsTag[];
487
+ /**
488
+ * The default value of the prop
489
+ */
490
+ default?: string;
491
+ /**
492
+ * Deprecation text associated with the prop. This is the text that immediately follows a `@deprecated` tag
493
+ */
494
+ deprecation?: string;
495
+ values: JsonDocsValue[];
496
+ /**
497
+ * `true` if a component is declared with a '?', `false` otherwise
498
+ *
499
+ * @example
500
+ * ```tsx
501
+ * @Prop() componentProps?: any;
502
+ * ```
503
+ */
504
+ optional: boolean;
505
+ /**
506
+ * `true` if a component is declared with a '!', `false` otherwise
507
+ *
508
+ * @example
509
+ * ```tsx
510
+ * @Prop() componentProps!: any;
511
+ * ```
512
+ */
513
+ required: boolean;
514
+ /**
515
+ * `true` if the prop has a `get()`. `false` otherwise
516
+ */
517
+ getter: boolean;
518
+ /**
519
+ * `true` if the prop has a `set()`. `false` otherwise
520
+ */
521
+ setter: boolean;
522
+ }
523
+ interface JsonDocsMethod {
524
+ name: string;
525
+ docs: string;
526
+ docsTags: JsonDocsTag[];
527
+ deprecation?: string;
528
+ signature: string;
529
+ returns: JsonDocsMethodReturn;
530
+ parameters: JsonDocMethodParameter[];
531
+ complexType: ComponentCompilerMethodComplexType;
532
+ }
533
+ interface JsonDocsMethodReturn {
534
+ type: string;
535
+ docs: string;
536
+ }
537
+ interface JsonDocMethodParameter {
538
+ name: string;
539
+ type: string;
540
+ docs: string;
541
+ }
542
+ interface JsonDocsEvent {
543
+ event: string;
544
+ bubbles: boolean;
545
+ cancelable: boolean;
546
+ composed: boolean;
547
+ complexType: ComponentCompilerEventComplexType;
548
+ docs: string;
549
+ docsTags: JsonDocsTag[];
550
+ deprecation?: string;
551
+ detail: string;
552
+ }
553
+ /**
554
+ * Type describing a CSS Style, as described by a JSDoc-style comment
555
+ */
556
+ interface JsonDocsStyle {
557
+ /**
558
+ * The name of the style
559
+ */
560
+ name: string;
561
+ /**
562
+ * The type/description associated with the style
563
+ */
564
+ docs: string;
565
+ /**
566
+ * The annotation used in the JSDoc of the style (e.g. `@prop`)
567
+ */
568
+ annotation: string;
569
+ /**
570
+ * The mode associated with the style
571
+ */
572
+ mode: string | undefined;
573
+ }
574
+ interface JsonDocsListener {
575
+ event: string;
576
+ target?: string;
577
+ capture: boolean;
578
+ passive: boolean;
579
+ }
580
+ /**
581
+ * A descriptor for a slot
582
+ *
583
+ * Objects of this type are translated from the JSDoc tag, `@slot`
584
+ */
585
+ interface JsonDocsSlot {
586
+ /**
587
+ * The name of the slot. Defaults to an empty string for an unnamed slot.
588
+ */
589
+ name: string;
590
+ /**
591
+ * A textual description of the slot.
592
+ */
593
+ docs: string;
594
+ }
595
+ /**
596
+ * A descriptor of a CSS Shadow Part
597
+ *
598
+ * Objects of this type are translated from the JSDoc tag, `@part`, or the 'part'
599
+ * attribute on a component in TSX
600
+ */
601
+ interface JsonDocsPart {
602
+ /**
603
+ * The name of the Shadow part
604
+ */
605
+ name: string;
606
+ /**
607
+ * A textual description of the Shadow part.
608
+ */
609
+ docs: string;
610
+ }
611
+ /**
612
+ * A descriptor for a Custom State defined via @AttachInternals({ states: {...} })
613
+ *
614
+ * Custom states are exposed via the ElementInternals.states CustomStateSet
615
+ * and can be targeted with the CSS `:state()` pseudo-class.
616
+ *
617
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
618
+ */
619
+ interface JsonDocsCustomState {
620
+ /**
621
+ * The name of the custom state (without dashes)
622
+ */
623
+ name: string;
624
+ /**
625
+ * The initial/default value of the state
626
+ */
627
+ initialValue: boolean;
628
+ /**
629
+ * A textual description of the custom state
630
+ */
631
+ docs: string;
632
+ }
633
+ /**
634
+ * Represents a parsed block comment in a CSS, Sass, etc. file for a custom property.
635
+ */
636
+ interface StyleDoc {
637
+ /**
638
+ * The name of the CSS property
639
+ */
640
+ name: string;
641
+ /**
642
+ * The user-defined description of the CSS property
643
+ */
644
+ docs: string;
645
+ /**
646
+ * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
647
+ * Used to inform Stencil where the start of a new property's description starts (and where the previous description
648
+ * ends).
649
+ */
650
+ annotation: 'prop';
651
+ /**
652
+ * The Stencil style-mode that is associated with this property.
653
+ */
654
+ mode: string | undefined;
655
+ }
656
+ //#endregion
657
+ //#region src/declarations/stencil-private.d.ts
658
+ interface SourceMap {
659
+ file: string;
660
+ mappings: string;
661
+ names: string[];
662
+ sourceRoot?: string;
663
+ sources: string[];
664
+ sourcesContent?: (string | null)[];
665
+ version: number;
666
+ }
667
+ interface PrintLine {
668
+ lineIndex: number;
669
+ lineNumber: number;
670
+ text: string;
671
+ errorCharStart: number;
672
+ errorLength?: number;
673
+ }
674
+ interface BuildFeatures {
675
+ style: boolean;
676
+ mode: boolean;
677
+ formAssociated: boolean;
678
+ shadowDom: boolean;
679
+ shadowDelegatesFocus: boolean;
680
+ shadowModeClosed: boolean;
681
+ shadowSlotAssignmentManual: boolean;
682
+ scoped: boolean;
683
+ /**
684
+ * Every component has a render function
685
+ */
686
+ allRenderFn: boolean;
687
+ /**
688
+ * At least one component has a render function
689
+ */
690
+ hasRenderFn: boolean;
691
+ vdomRender: boolean;
692
+ vdomAttribute: boolean;
693
+ vdomClass: boolean;
694
+ vdomFunctional: boolean;
695
+ vdomKey: boolean;
696
+ vdomListener: boolean;
697
+ vdomPropOrAttr: boolean;
698
+ vdomRef: boolean;
699
+ vdomStyle: boolean;
700
+ vdomText: boolean;
701
+ vdomXlink: boolean;
702
+ vdomSignals: boolean;
703
+ slotRelocation: boolean;
704
+ patchAll: boolean;
705
+ patchChildren: boolean;
706
+ patchClone: boolean;
707
+ patchInsert: boolean;
708
+ slot: boolean;
709
+ svg: boolean;
710
+ element: boolean;
711
+ event: boolean;
712
+ hostListener: boolean;
713
+ hostListenerTargetWindow: boolean;
714
+ hostListenerTargetDocument: boolean;
715
+ hostListenerTargetBody: boolean;
716
+ hostListenerTarget: boolean;
717
+ method: boolean;
718
+ prop: boolean;
719
+ propChangeCallback: boolean;
720
+ propMutable: boolean;
721
+ state: boolean;
722
+ member: boolean;
723
+ updatable: boolean;
724
+ propBoolean: boolean;
725
+ propNumber: boolean;
726
+ propString: boolean;
727
+ serializer: boolean;
728
+ deserializer: boolean;
729
+ lifecycle: boolean;
730
+ asyncLoading: boolean;
731
+ observeAttribute: boolean;
732
+ reflect: boolean;
733
+ taskQueue: boolean;
734
+ }
735
+ interface BuildConditionals extends Partial<BuildFeatures> {
736
+ hotModuleReplacement?: boolean;
737
+ isDebug?: boolean;
738
+ isTesting?: boolean;
739
+ isDev?: boolean;
740
+ devTools?: boolean;
741
+ invisiblePrehydration?: boolean;
742
+ hydrateServerSide?: boolean;
743
+ hydrateClientSide?: boolean;
744
+ lifecycleDOMEvents?: boolean;
745
+ cssAnnotations?: boolean;
746
+ lazyLoad?: boolean;
747
+ profile?: boolean;
748
+ constructableCSS?: boolean;
749
+ /** True when `compat.lightDomPatches === true` - enables `applyLightDomPatches` shortcut. */
750
+ lightDomPatches?: boolean;
751
+ /** Patch `childNodes`/`children` getters on light-dom slotted components. */
752
+ slotChildNodes?: boolean;
753
+ /** Patch `cloneNode()` on light-dom slotted components. */
754
+ slotCloneNode?: boolean;
755
+ /** Patch `appendChild`/`insertBefore`/`removeChild` on light-dom slotted components. */
756
+ slotDomMutations?: boolean;
757
+ /** Patch `textContent` on light-dom slotted components. */
758
+ slotTextContent?: boolean;
759
+ hydratedAttribute?: boolean;
760
+ hydratedClass?: boolean;
761
+ hydratedSelectorName?: string;
762
+ /** True when a global-style input contains `@import "stencil-hydrate"` - suppresses dynamic style injection in the loader. */
763
+ staticHydrationStyles?: boolean;
764
+ initializeNextTick?: boolean;
765
+ asyncQueue?: boolean;
766
+ additionalTagTransformers?: boolean | 'prod';
767
+ signalBacking?: boolean;
768
+ /** True when JSX signal bypass is active - text nodes and attributes backed by Signal objects update the DOM directly. Auto-enabled when `signalBacking: true`. */
769
+ vdomSignals?: boolean;
770
+ }
771
+ type ModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd' | 'commonjs' | 'esm' | 'module' | 'systemjs';
772
+ interface RolldownResultModule {
773
+ id: string;
774
+ }
775
+ interface RolldownResults {
776
+ modules: RolldownResultModule[];
777
+ }
778
+ interface BuildCtx {
779
+ buildId: number;
780
+ buildResults: CompilerBuildResults;
781
+ buildStats?: Result<CompilerBuildStats, {
782
+ diagnostics: Diagnostic[];
783
+ }>;
784
+ buildMessages: string[];
785
+ bundleBuildCount: number;
786
+ collections: CollectionCompilerMeta[];
787
+ compilerCtx: CompilerCtx;
788
+ esmBrowserComponentBundle: ReadonlyArray<BundleModule>;
789
+ esmComponentBundle: ReadonlyArray<BundleModule>;
790
+ commonJsComponentBundle: ReadonlyArray<BundleModule>;
791
+ components: ComponentCompilerMeta[];
792
+ componentGraph: Map<string, string[]>;
793
+ config: ValidatedConfig;
794
+ createTimeSpan(msg: string, debug?: boolean): LoggerTimeSpan;
795
+ data: any;
796
+ debug: (msg: string) => void;
797
+ diagnostics: Diagnostic[];
798
+ dirsAdded: string[];
799
+ dirsDeleted: string[];
800
+ entryModules: EntryModule[];
801
+ filesAdded: string[];
802
+ filesChanged: string[];
803
+ filesDeleted: string[];
804
+ filesUpdated: string[];
805
+ filesWritten: string[];
806
+ globalStyle: string | undefined;
807
+ hasConfigChanges: boolean;
808
+ hasError: boolean;
809
+ hasFinished: boolean;
810
+ hasHtmlChanges: boolean;
811
+ hasPrintedResults: boolean;
812
+ hasServiceWorkerChanges: boolean;
813
+ hasScriptChanges: boolean;
814
+ hasStyleChanges: boolean;
815
+ hasWarning: boolean;
816
+ ssrAppFilePath: string;
817
+ indexBuildCount: number;
818
+ indexDoc: Document;
819
+ /** All non-entry HTML files found in srcDir, keyed by path relative to srcDir */
820
+ htmlDocs: Map<string, Document>;
821
+ isRebuild: boolean;
822
+ /**
823
+ * A collection of Stencil's intermediate representation of components, tied to the current build
824
+ */
825
+ moduleFiles: Module[];
826
+ packageJson: PackageJsonData | null;
827
+ pendingCopyTasks: Promise<CopyResults>[];
828
+ progress(task: BuildTask): void;
829
+ requiresFullBuild: boolean;
830
+ rolldownResults?: RolldownResults;
831
+ scriptsAdded: string[];
832
+ scriptsDeleted: string[];
833
+ startTime: number;
834
+ styleBuildCount: number;
835
+ /**
836
+ * A promise that resolves to the global styles for the current build.
837
+ */
838
+ stylesPromise: Promise<string>;
839
+ stylesUpdated: BuildStyleUpdate[];
840
+ timeSpan: LoggerTimeSpan;
841
+ timestamp: string;
842
+ transpileBuildCount: number;
843
+ validateTypesBuild?(): Promise<void>;
844
+ validateTypesHandler?: (results: any) => Promise<void>;
845
+ validateTypesPromise?: Promise<any>;
846
+ }
847
+ interface BuildStyleUpdate {
848
+ styleTag: string;
849
+ styleText: string;
850
+ styleMode: string;
851
+ }
852
+ type BuildTask = any;
853
+ interface CompilerBuildStats {
854
+ timestamp: string;
855
+ compiler: {
856
+ name: string;
857
+ version: string;
858
+ };
859
+ app: {
860
+ namespace: string;
861
+ fsNamespace: string;
862
+ components: number;
863
+ entries: number;
864
+ bundles: number;
865
+ outputs: any;
866
+ };
867
+ options: {
868
+ minifyJs: boolean;
869
+ minifyCss: boolean;
870
+ };
871
+ formats: {
872
+ esmBrowser: ReadonlyArray<CompilerBuildStatBundle>;
873
+ esm: ReadonlyArray<CompilerBuildStatBundle>;
874
+ commonjs: ReadonlyArray<CompilerBuildStatBundle>;
875
+ };
876
+ components: BuildComponent[];
877
+ entries: EntryModule[];
878
+ rolldownResults: RolldownResults;
879
+ sourceGraph?: BuildSourceGraph;
880
+ componentGraph: BuildResultsComponentGraph;
881
+ collections: CompilerBuildStatCollection[];
882
+ }
883
+ interface CompilerBuildStatCollection {
884
+ name: string;
885
+ source: string;
886
+ tags: string[][];
887
+ }
888
+ interface CompilerBuildStatBundle {
889
+ key: string;
890
+ components: string[];
891
+ bundleId: string;
892
+ fileName: string;
893
+ imports: string[];
894
+ originalByteSize: number;
895
+ }
896
+ interface BuildSourceGraph {
897
+ [filePath: string]: string[];
898
+ }
899
+ interface BuildComponent {
900
+ tag: string;
901
+ dependencyOf?: string[];
902
+ dependencies?: string[];
903
+ }
904
+ interface RolldownChunkResult {
905
+ type: 'chunk';
906
+ entryKey: string;
907
+ fileName: string;
908
+ code: string;
909
+ isEntry: boolean;
910
+ isComponent: boolean;
911
+ isCore: boolean;
912
+ isIndex: boolean;
913
+ isBrowserLoader: boolean;
914
+ imports: string[];
915
+ moduleFormat: ModuleFormat;
916
+ map?: RolldownSourceMap;
917
+ }
918
+ interface BundleModule {
919
+ entryKey: string;
920
+ rolldownResult: RolldownChunkResult;
921
+ cmps: ComponentCompilerMeta[];
922
+ output: BundleModuleOutput;
923
+ }
924
+ interface BundleModuleOutput {
925
+ bundleId: string;
926
+ fileName: string;
927
+ code: string;
928
+ }
929
+ interface Cache {
930
+ get(key: string): Promise<string | null>;
931
+ put(key: string, value: string): Promise<boolean>;
932
+ has(key: string): Promise<boolean>;
933
+ createKey(domain: string, ...args: any[]): Promise<string>;
934
+ commit(): Promise<void>;
935
+ clear(): void;
936
+ clearDiskCache(): Promise<void>;
937
+ getMemoryStats(): string;
938
+ initCacheDir(): Promise<void>;
939
+ }
940
+ interface CollectionCompilerMeta {
941
+ collectionName: string;
942
+ moduleId?: string;
943
+ moduleDir: string;
944
+ moduleFiles: Module[];
945
+ global?: Module;
946
+ compiler?: CollectionCompilerVersion;
947
+ isInitialized?: boolean;
948
+ hasExports?: boolean;
949
+ dependencies?: string[];
950
+ bundles?: {
951
+ components: string[];
952
+ }[];
953
+ buildFlags?: Partial<BuildConditionals>;
954
+ }
955
+ interface CollectionCompilerVersion {
956
+ name: string;
957
+ version: string;
958
+ typescriptVersion?: string;
959
+ }
960
+ /**
961
+ * A memoized result of the SASS + Lightning CSS transformation for a single stylesheet, keyed by
962
+ * the annotated Rolldown import id (e.g. `/path/to/comp.scss?tag=ion-button&encapsulation=shadow`).
963
+ *
964
+ * Storing this allows all output targets (customElements, lazy, hydrate) that process the same
965
+ * stylesheets to share a single computation instead of repeating it N times.
966
+ */
967
+ interface CssTransformCacheEntry {
968
+ /** Resolved file ID after plugin (SASS) transforms */
969
+ pluginTransformId: string;
970
+ /** CSS source produced by the SASS / plugin pipeline */
971
+ pluginTransformCode: string;
972
+ /** File dependencies discovered during the SASS transform (e.g. `@import`-ed partials) */
973
+ pluginTransformDependencies: string[];
974
+ /** Diagnostics emitted during the plugin transform pass */
975
+ pluginTransformDiagnostics: Diagnostic[];
976
+ /** Full output of the subsequent `transformCssToEsm` call */
977
+ cssTransformOutput: TransformCssToEsmOutput;
978
+ }
979
+ interface CompilerCtx {
980
+ version: number;
981
+ activeBuildId: number;
982
+ activeDirsAdded: string[];
983
+ activeDirsDeleted: string[];
984
+ activeFilesAdded: string[];
985
+ activeFilesDeleted: string[];
986
+ activeFilesUpdated: string[];
987
+ addWatchDir: (path: string, recursive: boolean) => void;
988
+ addWatchFile: (path: string) => void;
989
+ cache: Cache;
990
+ cssModuleImports: Map<string, string[]>;
991
+ /** Cache of built global styles, keyed by input file path */
992
+ globalStyleCache: Map<string, string>;
993
+ collections: CollectionCompilerMeta[];
994
+ compilerOptions: any;
995
+ events: BuildEvents;
996
+ fs: InMemoryFileSystem;
997
+ hasSuccessfulBuild: boolean;
998
+ isActivelyBuilding: boolean;
999
+ lastBuildResults: CompilerBuildResults;
1000
+ /**
1001
+ * A mapping of a file path to a Stencil {@link Module}
1002
+ */
1003
+ moduleMap: ModuleMap;
1004
+ nodeMap: NodeMap;
1005
+ resolvedCollections: Set<string>;
1006
+ rolldownCacheSsr: any;
1007
+ rolldownCacheLazy: any;
1008
+ rolldownCacheNative: any;
1009
+ styleModeNames: Set<string>;
1010
+ changedModules: Set<string>;
1011
+ changedFiles: Set<string>;
1012
+ worker?: CompilerWorkerContext;
1013
+ rolldownCache: Map<string, any>;
1014
+ /**
1015
+ * Cross-build cache for {@link ts.transpileModule} results.
1016
+ * Keyed by `"${bundleId}:${normalizedFilePath}"`. Invalidated for any
1017
+ * file that appears in {@link changedModules} after TypeScript re-emits.
1018
+ * @see transpileCache in compiler-ctx.ts
1019
+ */
1020
+ transpileCache: Map<string, {
1021
+ outputText: string;
1022
+ sourceMapText: string | null;
1023
+ }>;
1024
+ /**
1025
+ * Cross-build cache of the last style text pushed to the HMR client.
1026
+ * Keyed by getScopeId result (e.g. "ion-accordion$ios"). Used by
1027
+ * extTransformsPlugin to avoid re-pushing unchanged styles on every rebuild.
1028
+ */
1029
+ prevStylesMap: Map<string, string>;
1030
+ /**
1031
+ * Cross-output-target cache for the SASS + Lightning CSS computation.
1032
+ * Keyed by the annotated Rolldown import id. Null entries indicate that the
1033
+ * source file could not be read (propagated as a `null` return from the
1034
+ * transform hook).
1035
+ *
1036
+ * Entries are invalidated in `invalidateRolldownCaches` whenever a
1037
+ * source file or one of its SASS dependencies is modified.
1038
+ */
1039
+ cssTransformCache: Map<string, CssTransformCacheEntry | null>;
1040
+ reset(): void;
1041
+ }
1042
+ type NodeMap = WeakMap<any, ComponentCompilerMeta>;
1043
+ /**
1044
+ * Record, for a specific component, whether or not it has various features
1045
+ * which need to be handled correctly in the compilation pipeline.
1046
+ *
1047
+ * Note: this must be serializable to JSON.
1048
+ */
1049
+ interface ComponentCompilerFeatures {
1050
+ hasAttribute: boolean;
1051
+ hasAttributeChangedCallbackFn: boolean;
1052
+ hasComponentWillLoadFn: boolean;
1053
+ hasComponentDidLoadFn: boolean;
1054
+ hasComponentShouldUpdateFn: boolean;
1055
+ hasComponentWillUpdateFn: boolean;
1056
+ hasComponentDidUpdateFn: boolean;
1057
+ hasComponentWillRenderFn: boolean;
1058
+ hasComponentDidRenderFn: boolean;
1059
+ hasConnectedCallbackFn: boolean;
1060
+ hasDeserializer: boolean;
1061
+ hasDisconnectedCallbackFn: boolean;
1062
+ hasElement: boolean;
1063
+ hasEvent: boolean;
1064
+ hasLifecycle: boolean;
1065
+ hasListener: boolean;
1066
+ hasListenerTarget: boolean;
1067
+ hasListenerTargetWindow: boolean;
1068
+ hasListenerTargetDocument: boolean;
1069
+ hasListenerTargetBody: boolean;
1070
+ hasMember: boolean;
1071
+ hasMethod: boolean;
1072
+ hasMode: boolean;
1073
+ hasModernPropertyDecls: boolean;
1074
+ hasPatchAll: boolean;
1075
+ hasPatchChildren: boolean;
1076
+ hasPatchClone: boolean;
1077
+ hasPatchInsert: boolean;
1078
+ hasProp: boolean;
1079
+ hasPropBoolean: boolean;
1080
+ hasPropNumber: boolean;
1081
+ hasPropString: boolean;
1082
+ hasPropMutable: boolean;
1083
+ hasReflect: boolean;
1084
+ hasRenderFn: boolean;
1085
+ hasSerializer: boolean;
1086
+ hasSlot: boolean;
1087
+ hasState: boolean;
1088
+ hasStyle: boolean;
1089
+ hasVdomAttribute: boolean;
1090
+ hasVdomClass: boolean;
1091
+ hasVdomFunctional: boolean;
1092
+ hasVdomKey: boolean;
1093
+ hasVdomListener: boolean;
1094
+ hasVdomPropOrAttr: boolean;
1095
+ hasVdomRef: boolean;
1096
+ hasVdomRender: boolean;
1097
+ hasVdomStyle: boolean;
1098
+ hasVdomText: boolean;
1099
+ hasVdomXlink: boolean;
1100
+ hasSignalsImport: boolean;
1101
+ hasWatchCallback: boolean;
1102
+ htmlAttrNames: string[];
1103
+ htmlTagNames: string[];
1104
+ htmlParts: string[];
1105
+ isUpdateable: boolean;
1106
+ /**
1107
+ * A plain component is one that doesn't have:
1108
+ * - any members decorated with `@Prop()`, `@State()`, `@Element()`, `@Method()`
1109
+ * - any methods decorated with `@Listen()`
1110
+ * - any styles
1111
+ * - any lifecycle methods, including `render()`
1112
+ */
1113
+ isPlain: boolean;
1114
+ /**
1115
+ * A collection of tag names of web components that a component references in its JSX/h() function
1116
+ */
1117
+ potentialCmpRefs: string[];
1118
+ }
1119
+ /**
1120
+ * Metadata about a given component
1121
+ *
1122
+ * Note: must be serializable to JSON!
1123
+ */
1124
+ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1125
+ assetsDirs: CompilerAssetDir[];
1126
+ /**
1127
+ * The name to which an `ElementInternals` object (the return value of
1128
+ * `HTMLElement.attachInternals`) should be attached at runtime. If this is
1129
+ * `null` then `attachInternals` should not be called.
1130
+ */
1131
+ attachInternalsMemberName: string | null;
1132
+ /**
1133
+ * Custom states to initialize on the ElementInternals.states CustomStateSet.
1134
+ * These are defined via @AttachInternals({ states: {...} }).
1135
+ */
1136
+ attachInternalsCustomStates: ComponentCompilerCustomState[];
1137
+ componentClassName: string;
1138
+ /**
1139
+ * A list of web component tag names that are either:
1140
+ * - directly referenced in a Stencil component's JSX/h() function
1141
+ * - are referenced by a web component that is directly referenced in a Stencil component's JSX/h() function
1142
+ */
1143
+ dependencies: string[];
1144
+ /**
1145
+ * A list of web component tag names that either:
1146
+ * - directly reference the current component directly in their JSX/h() function
1147
+ * - indirectly/transitively reference the current component directly in their JSX/h() function
1148
+ */
1149
+ dependents: string[];
1150
+ deserializers: ComponentCompilerChangeHandler[];
1151
+ /**
1152
+ * A list of web component tag names that are directly referenced in a Stencil component's JSX/h() function
1153
+ */
1154
+ directDependencies: string[];
1155
+ /**
1156
+ * A list of web component tag names that the current component directly in their JSX/h() function
1157
+ */
1158
+ directDependents: string[];
1159
+ docs: CompilerJsDoc;
1160
+ doesExtend: boolean;
1161
+ elementRef: string;
1162
+ encapsulation: Encapsulation;
1163
+ events: ComponentCompilerEvent[];
1164
+ excludeFromCollection: boolean;
1165
+ /**
1166
+ * Whether or not the component is form-associated
1167
+ */
1168
+ formAssociated: boolean;
1169
+ internal: boolean;
1170
+ isCollectionDependency: boolean;
1171
+ jsFilePath: string;
1172
+ listeners: ComponentCompilerListener[];
1173
+ methods: ComponentCompilerMethod[];
1174
+ properties: ComponentCompilerProperty[];
1175
+ serializers: ComponentCompilerChangeHandler[];
1176
+ shadowDelegatesFocus: boolean;
1177
+ /**
1178
+ * Shadow DOM mode. 'open' (default) or 'closed'.
1179
+ * Only applicable when encapsulation is 'shadow'.
1180
+ */
1181
+ shadowMode: 'open' | 'closed' | null;
1182
+ /**
1183
+ * Slot assignment mode for shadow DOM. 'manual', enables imperative slotting
1184
+ * using HTMLSlotElement.assign(). Only applicable when encapsulation is 'shadow'.
1185
+ */
1186
+ slotAssignment: 'manual' | null;
1187
+ /**
1188
+ * Per-component slot patches for non-shadow DOM components.
1189
+ * These patches enable proper slot behavior without native Shadow DOM.
1190
+ * Only applicable when encapsulation is 'none' or 'scoped'.
1191
+ */
1192
+ patches: ComponentPatches | null;
1193
+ sourceFilePath: string;
1194
+ sourceMapPath: string;
1195
+ states: ComponentCompilerState[];
1196
+ styleDocs: CompilerStyleDoc[];
1197
+ styles: StyleCompiler[];
1198
+ globalStyles: ComponentGlobalStyle[];
1199
+ tagName: string;
1200
+ virtualProperties: ComponentCompilerVirtualProperty[];
1201
+ watchers: ComponentCompilerChangeHandler[];
1202
+ }
1203
+ /**
1204
+ * The supported style encapsulation modes on a Stencil component:
1205
+ * 1. 'shadow' - native Shadow DOM
1206
+ * 2. 'scoped' - encapsulated styles and polyfilled slots
1207
+ * 3. 'none' - a basic HTML element
1208
+ */
1209
+ type Encapsulation = 'shadow' | 'scoped' | 'none';
1210
+ /**
1211
+ * Per-component slot patches for non-shadow DOM components.
1212
+ * These enable proper slot behavior when not using native Shadow DOM.
1213
+ */
1214
+ interface ComponentPatches {
1215
+ /** Apply all slot patches (equivalent to lightDomPatches) */
1216
+ all?: boolean;
1217
+ /** Patch child node accessors (children, firstChild, lastChild, etc.) */
1218
+ children?: boolean;
1219
+ /** Patch cloneNode() to handle slotted content */
1220
+ clone?: boolean;
1221
+ /** Patch appendChild(), insertBefore(), etc. for slot relocation */
1222
+ insert?: boolean;
1223
+ }
1224
+ /**
1225
+ * Intermediate Representation (IR) of a static property on a Stencil component
1226
+ */
1227
+ interface ComponentCompilerStaticProperty {
1228
+ mutable: boolean;
1229
+ optional: boolean;
1230
+ required: boolean;
1231
+ type: ComponentCompilerPropertyType;
1232
+ complexType: ComponentCompilerPropertyComplexType;
1233
+ attribute?: string;
1234
+ reflect?: boolean;
1235
+ docs: CompilerJsDoc;
1236
+ defaultValue?: string;
1237
+ getter: boolean;
1238
+ setter: boolean;
1239
+ ogPropName?: string;
1240
+ }
1241
+ /**
1242
+ * Intermediate Representation (IR) of a property on a Stencil component
1243
+ */
1244
+ interface ComponentCompilerProperty extends ComponentCompilerStaticProperty {
1245
+ name: string;
1246
+ internal: boolean;
1247
+ }
1248
+ interface ComponentCompilerVirtualProperty {
1249
+ name: string;
1250
+ type: string;
1251
+ docs: string;
1252
+ }
1253
+ type ComponentCompilerPropertyType = 'any' | 'string' | 'boolean' | 'number' | 'unknown';
1254
+ /**
1255
+ * Information about a type used in a Stencil component or exported
1256
+ * from a Stencil project.
1257
+ */
1258
+ interface ComponentCompilerPropertyComplexType {
1259
+ /**
1260
+ * The string of the original type annotation in the Stencil source code
1261
+ */
1262
+ original: string;
1263
+ /**
1264
+ * A 'resolved' type, where e.g. imported types have been resolved and inlined
1265
+ *
1266
+ * For instance, an annotation like `(foo: Foo) => string;` will be
1267
+ * converted to `(foo: { foo: string }) => string;`.
1268
+ */
1269
+ resolved: string;
1270
+ /**
1271
+ * A record of the types which were referenced in the assorted type
1272
+ * annotation in the original source file.
1273
+ */
1274
+ references: ComponentCompilerTypeReferences;
1275
+ /**
1276
+ * @internal TypeScript AST node used for semantic type analysis during compilation.
1277
+ * Not serialized, only used internally for improved type renaming logic.
1278
+ */
1279
+ _astNode?: any;
1280
+ }
1281
+ /**
1282
+ * A record of `ComponentCompilerTypeReference` entities.
1283
+ *
1284
+ * Each key in this record is intended to be the names of the types used by a component. However, this is not enforced
1285
+ * by the type system (I.E. any string can be used as a key).
1286
+ *
1287
+ * Note any key can be a user defined type or a TypeScript standard type.
1288
+ */
1289
+ type ComponentCompilerTypeReferences = Record<string, ComponentCompilerTypeReference>;
1290
+ /**
1291
+ * Describes a reference to a type used by a component.
1292
+ */
1293
+ interface ComponentCompilerTypeReference {
1294
+ /**
1295
+ * A type may be defined:
1296
+ * - locally (in the same file as the component that uses it)
1297
+ * - globally
1298
+ * - by importing it into a file (and is defined elsewhere)
1299
+ */
1300
+ location: 'local' | 'global' | 'import';
1301
+ /**
1302
+ * The path to the type reference, if applicable (global types should not need a path associated with them)
1303
+ */
1304
+ path?: string;
1305
+ /**
1306
+ * An ID for this type which is unique within a Stencil project.
1307
+ */
1308
+ id: string;
1309
+ /**
1310
+ * Whether this type was imported as a default import (e.g., `import MyEnum from './my-enum'`)
1311
+ * vs a named import (e.g., `import { MyType } from './my-type'`)
1312
+ */
1313
+ isDefault?: boolean;
1314
+ /**
1315
+ * The name used in the import statement (before any user-defined alias).
1316
+ * For `import { XAxisOption as moo }`, this would be "XAxisOption".
1317
+ * This is the name exported by the source module.
1318
+ */
1319
+ referenceLocation?: string;
1320
+ }
1321
+ /**
1322
+ * Information about a type which is referenced by another type on a Stencil
1323
+ * component, for instance a {@link ComponentCompilerPropertyComplexType} or a
1324
+ * {@link ComponentCompilerEventComplexType}.
1325
+ */
1326
+ interface ComponentCompilerReferencedType {
1327
+ /**
1328
+ * The path to the module where the type is declared.
1329
+ */
1330
+ path: string;
1331
+ /**
1332
+ * The string of the original type annotation in the Stencil source code
1333
+ */
1334
+ declaration: string;
1335
+ /**
1336
+ * An extracted docstring
1337
+ */
1338
+ docstring: string;
1339
+ }
1340
+ interface ComponentCompilerStaticEvent {
1341
+ name: string;
1342
+ method: string;
1343
+ bubbles: boolean;
1344
+ cancelable: boolean;
1345
+ composed: boolean;
1346
+ docs: CompilerJsDoc;
1347
+ complexType: ComponentCompilerEventComplexType;
1348
+ }
1349
+ interface ComponentCompilerEvent extends ComponentCompilerStaticEvent {
1350
+ internal: boolean;
1351
+ }
1352
+ interface ComponentCompilerEventComplexType {
1353
+ original: string;
1354
+ resolved: string;
1355
+ references: ComponentCompilerTypeReferences;
1356
+ }
1357
+ interface ComponentCompilerListener {
1358
+ name: string;
1359
+ method: string;
1360
+ capture: boolean;
1361
+ passive: boolean;
1362
+ target: ListenTargetOptions | undefined;
1363
+ }
1364
+ interface ComponentCompilerStaticMethod {
1365
+ docs: CompilerJsDoc;
1366
+ complexType: ComponentCompilerMethodComplexType;
1367
+ }
1368
+ interface ComponentCompilerMethodComplexType {
1369
+ signature: string;
1370
+ parameters: JsonDocMethodParameter[];
1371
+ references: ComponentCompilerTypeReferences;
1372
+ return: string;
1373
+ /**
1374
+ * @internal TypeScript AST method node used for semantic type analysis during compilation.
1375
+ * Not serialized, only used internally for improved type renaming logic.
1376
+ */
1377
+ _astNode?: any;
1378
+ }
1379
+ interface ComponentCompilerChangeHandler {
1380
+ propName: string;
1381
+ methodName: string;
1382
+ handlerOptions?: {
1383
+ immediate?: boolean;
1384
+ };
1385
+ }
1386
+ interface ComponentCompilerMethod extends ComponentCompilerStaticMethod {
1387
+ name: string;
1388
+ internal: boolean;
1389
+ }
1390
+ interface ComponentCompilerState {
1391
+ name: string;
1392
+ }
1393
+ /**
1394
+ * Metadata about a custom state defined via @AttachInternals({ states: {...} })
1395
+ *
1396
+ * Custom states are exposed via the ElementInternals.states CustomStateSet
1397
+ * and can be targeted with the CSS :state() pseudo-class.
1398
+ */
1399
+ interface ComponentCompilerCustomState {
1400
+ /**
1401
+ * The name of the custom state (without dashes)
1402
+ */
1403
+ name: string;
1404
+ /**
1405
+ * The initial value of the state
1406
+ */
1407
+ initialValue: boolean;
1408
+ /**
1409
+ * Optional JSDoc description for the state
1410
+ */
1411
+ docs: string;
1412
+ }
1413
+ /**
1414
+ * Representation of JSDoc that is pulled off a node in the AST
1415
+ */
1416
+ interface CompilerJsDoc {
1417
+ /**
1418
+ * The text associated with the JSDoc
1419
+ */
1420
+ text: string;
1421
+ /**
1422
+ * Tags included in the JSDoc
1423
+ */
1424
+ tags: CompilerJsDocTagInfo[];
1425
+ }
1426
+ /**
1427
+ * Representation of a tag that exists in a JSDoc
1428
+ */
1429
+ interface CompilerJsDocTagInfo {
1430
+ /**
1431
+ * The name of the tag - e.g. `@deprecated`
1432
+ */
1433
+ name: string;
1434
+ /**
1435
+ * Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
1436
+ */
1437
+ text?: string;
1438
+ }
1439
+ /**
1440
+ * The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
1441
+ * the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
1442
+ */
1443
+ interface CompilerStyleDoc {
1444
+ /**
1445
+ * The name of the CSS property
1446
+ */
1447
+ name: string;
1448
+ /**
1449
+ * The user-defined description of the CSS property
1450
+ */
1451
+ docs: string;
1452
+ /**
1453
+ * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
1454
+ * Used to inform Stencil where the start of a new property's description starts (and where the previous description
1455
+ * ends).
1456
+ */
1457
+ annotation: 'prop';
1458
+ /**
1459
+ * The Stencil style-mode that is associated with this property.
1460
+ */
1461
+ mode: string;
1462
+ }
1463
+ interface CompilerAssetDir {
1464
+ absolutePath?: string;
1465
+ cmpRelativePath?: string;
1466
+ originalComponentPath?: string;
1467
+ }
1468
+ interface EntryModule {
1469
+ entryKey: string;
1470
+ cmps: ComponentCompilerMeta[];
1471
+ }
1472
+ /**
1473
+ * A mapping from a TypeScript or JavaScript source file path on disk, to a Stencil {@link Module}.
1474
+ *
1475
+ * It is advised that the key (path) be normalized before storing/retrieving the `Module` to avoid unnecessary lookup
1476
+ * failures.
1477
+ */
1478
+ type ModuleMap = Map<string, Module>;
1479
+ /**
1480
+ * Stencil's Intermediate Representation (IR) of a module, bundling together
1481
+ * various pieces of information like the classes declared within it, the path
1482
+ * to the original source file, HTML tag names defined in the file, and so on.
1483
+ *
1484
+ * Note that this gets serialized/parsed as JSON and therefore cannot contain a
1485
+ * `Map` or a `Set`.
1486
+ */
1487
+ interface Module {
1488
+ cmps: ComponentCompilerMeta[];
1489
+ isMixin: boolean;
1490
+ isExtended: boolean;
1491
+ /**
1492
+ * Indicates this module contains mixin/abstract classes that can be extended by other projects.
1493
+ * These are classes with Stencil static members (properties, states, etc.) but no @Component decorator.
1494
+ */
1495
+ hasExportableMixins: boolean;
1496
+ /**
1497
+ * A collection of modules that a component will need. The modules in this list must have import statements generated
1498
+ * in order for the component to function.
1499
+ */
1500
+ coreRuntimeApis: string[];
1501
+ /**
1502
+ * A collection of modules that a component will need for a specific output target. The modules in this list must
1503
+ * have import statements generated in order for the component to function, but only for a specific output target.
1504
+ */
1505
+ outputTargetCoreRuntimeApis: Partial<Record<OutputTarget['type'], string[]>>;
1506
+ collectionName: string;
1507
+ dtsFilePath: string;
1508
+ excludeFromCollection: boolean;
1509
+ externalImports: string[];
1510
+ htmlAttrNames: string[];
1511
+ htmlTagNames: string[];
1512
+ htmlParts: string[];
1513
+ isCollectionDependency: boolean;
1514
+ isLegacy: boolean;
1515
+ jsFilePath: string;
1516
+ localImports: string[];
1517
+ /**
1518
+ * Source file paths of functional components that are used in JSX/h() calls.
1519
+ * This is used to ensure htmlTagNames are properly propagated from functional
1520
+ * component dependencies even when they're accessed indirectly (e.g., via barrel files).
1521
+ */
1522
+ functionalComponentDeps: string[];
1523
+ originalImports: string[];
1524
+ originalCollectionComponentPath: string;
1525
+ potentialCmpRefs: string[];
1526
+ sourceFilePath: string;
1527
+ staticSourceFile: any;
1528
+ staticSourceFileText: string;
1529
+ sourceMapPath: string;
1530
+ sourceMapFileText: string;
1531
+ hasVdomAttribute: boolean;
1532
+ hasVdomClass: boolean;
1533
+ hasVdomFunctional: boolean;
1534
+ hasVdomKey: boolean;
1535
+ hasVdomListener: boolean;
1536
+ hasVdomPropOrAttr: boolean;
1537
+ hasVdomRef: boolean;
1538
+ hasVdomRender: boolean;
1539
+ hasVdomStyle: boolean;
1540
+ hasVdomText: boolean;
1541
+ hasVdomXlink: boolean;
1542
+ hasSignalsImport: boolean;
1543
+ }
1544
+ interface PrerenderUrlResults {
1545
+ anchorUrls: string[];
1546
+ diagnostics: Diagnostic[];
1547
+ filePath: string;
1548
+ }
1549
+ interface PrerenderUrlRequest {
1550
+ appDir: string;
1551
+ buildId: string;
1552
+ baseUrl: string;
1553
+ componentGraphPath: string;
1554
+ devServerHostUrl: string;
1555
+ ssrAppFilePath: string;
1556
+ isDebug: boolean;
1557
+ prerenderConfigPath: string;
1558
+ staticSite: boolean;
1559
+ templateId: string;
1560
+ url: string;
1561
+ writeToFilePath: string;
1562
+ }
1563
+ interface StyleCompiler {
1564
+ modeName: string;
1565
+ styleId: string;
1566
+ styleStr: string;
1567
+ styleIdentifier: string;
1568
+ externalStyles: ExternalStyleCompiler[];
1569
+ }
1570
+ interface ExternalStyleCompiler {
1571
+ absolutePath: string;
1572
+ relativePath: string;
1573
+ originalComponentPath: string;
1574
+ }
1575
+ interface ComponentGlobalStyle {
1576
+ /** Absolute path to the CSS file, or null for inline styles */
1577
+ absolutePath: string | null;
1578
+ /** Raw inline CSS string, or null for file-based styles */
1579
+ styleStr: string | null;
1580
+ }
1581
+ /**
1582
+ * Input CSS to be transformed into ESM
1583
+ */
1584
+ interface TransformCssToEsmInput {
1585
+ input: string;
1586
+ module?: 'cjs' | 'esm' | string;
1587
+ file?: string;
1588
+ tag?: string;
1589
+ tags?: string[];
1590
+ addTagTransformers: boolean;
1591
+ encapsulation?: string;
1592
+ /**
1593
+ * The mode under which the CSS will be applied.
1594
+ *
1595
+ * Corresponds to a key used when `@Component`'s `styleUrls` field is an object:
1596
+ * ```ts
1597
+ * @Component({
1598
+ * tag: 'todo-list',
1599
+ * styleUrls: {
1600
+ * ios: 'todo-list.ios.scss',
1601
+ * md: 'todo-list.md.scss',
1602
+ * }
1603
+ * })
1604
+ * ```
1605
+ * In the example above, two `TransformCssToEsmInput`s should be created, one for 'ios' and one for 'md' (this field
1606
+ * is not shared by multiple fields, nor is it a composite of multiple modes).
1607
+ */
1608
+ mode?: string;
1609
+ sourceMap?: boolean;
1610
+ minify?: boolean;
1611
+ docs?: boolean;
1612
+ autoprefixer?: any;
1613
+ styleImportData?: string;
1614
+ }
1615
+ interface TransformCssToEsmOutput {
1616
+ styleText: string;
1617
+ output: string;
1618
+ map: any;
1619
+ diagnostics: Diagnostic[];
1620
+ defaultVarName: string;
1621
+ styleDocs: StyleDoc[];
1622
+ imports: {
1623
+ varName: string;
1624
+ importPath: string;
1625
+ }[];
1626
+ }
1627
+ interface PackageJsonData {
1628
+ name?: string;
1629
+ version?: string;
1630
+ type?: 'module' | 'commonjs';
1631
+ main?: string;
1632
+ exports?: {
1633
+ [key: string]: string | {
1634
+ [key: string]: string;
1635
+ };
1636
+ };
1637
+ description?: string;
1638
+ bin?: {
1639
+ [key: string]: string;
1640
+ };
1641
+ browser?: string;
1642
+ module?: string;
1643
+ 'jsnext:main'?: string;
1644
+ unpkg?: string;
1645
+ collection?: string;
1646
+ types?: string;
1647
+ files?: string[];
1648
+ ['dist-tags']?: {
1649
+ latest: string;
1650
+ };
1651
+ dependencies?: {
1652
+ [moduleId: string]: string;
1653
+ };
1654
+ devDependencies?: {
1655
+ [moduleId: string]: string;
1656
+ };
1657
+ repository?: {
1658
+ type?: string;
1659
+ url?: string;
1660
+ };
1661
+ private?: boolean;
1662
+ scripts?: {
1663
+ [runName: string]: string;
1664
+ };
1665
+ license?: string;
1666
+ keywords?: string[];
1667
+ }
1668
+ /**
1669
+ * An abstraction to bundle up four methods which _may_ be handled by
1670
+ * dispatching work to workers running in other OS threads or may be called
1671
+ * synchronously. Environment and `CompilerSystem` related setup code will
1672
+ * determine which one, but in either case the call sites for these methods can
1673
+ * dispatch to this shared interface.
1674
+ */
1675
+ interface CompilerWorkerContext {
1676
+ optimizeCss(inputOpts: OptimizeCssInput): Promise<OptimizeCssOutput>;
1677
+ prepareModule(input: string, minifyOpts: any): Promise<{
1678
+ output: string;
1679
+ diagnostics: Diagnostic[];
1680
+ sourceMap?: SourceMap;
1681
+ }>;
1682
+ prerenderWorker(prerenderRequest: PrerenderUrlRequest): Promise<PrerenderUrlResults>;
1683
+ transformCssToEsm(input: TransformCssToEsmInput): Promise<TransformCssToEsmOutput>;
1684
+ }
1685
+ //#endregion
1686
+ //#region src/declarations/stencil-public-compiler.d.ts
1687
+ /**
1688
+ * https://stenciljs.com/docs/config/
1689
+ */
1690
+ interface StencilConfig {
1691
+ /**
1692
+ * By default, Stencil will attempt to optimize small scripts by inlining them in HTML. Setting
1693
+ * this flag to `false` will prevent this optimization and keep all scripts separate from HTML.
1694
+ */
1695
+ allowInlineScripts?: boolean;
1696
+ /**
1697
+ * By setting `autoprefixCss` to `true`, Stencil will use the appropriate config to automatically
1698
+ * prefix css. For example, developers can write modern and standard css properties, such as
1699
+ * "transform", and Stencil will automatically add in the prefixed version, such as "-webkit-transform".
1700
+ * As of Stencil v2, autoprefixing CSS is no longer the default.
1701
+ * Defaults to `false`
1702
+ */
1703
+ autoprefixCss?: boolean | any;
1704
+ /**
1705
+ * By default, Stencil will statically analyze the application and generate a component graph of
1706
+ * how all the components are interconnected.
1707
+ *
1708
+ * From the component graph it is able to best decide how components should be grouped
1709
+ * depending on their usage with one another within the app.
1710
+ * By doing so it's able to bundle components together in order to reduce network requests.
1711
+ * However, bundles can be manually generated using the bundles config.
1712
+ *
1713
+ * The bundles config is an array of objects that represent how components are grouped together
1714
+ * in lazy-loaded bundles.
1715
+ * This config is rarely needed as Stencil handles this automatically behind the scenes.
1716
+ */
1717
+ bundles?: ConfigBundle[];
1718
+ /**
1719
+ * Stencil will cache build results in order to speed up rebuilds.
1720
+ * To disable this feature, set enableCache to false.
1721
+ */
1722
+ enableCache?: boolean;
1723
+ /**
1724
+ * The directory where sub-directories will be created for caching when `enableCache` is set
1725
+ * `true` or if using Stencil's Screenshot Connector.
1726
+ *
1727
+ * @default '.stencil'
1728
+ *
1729
+ * @example
1730
+ *
1731
+ * A Stencil config like the following:
1732
+ * ```ts
1733
+ * export const config = {
1734
+ * ...,
1735
+ * enableCache: true,
1736
+ * cacheDir: '.cache',
1737
+ * testing: {
1738
+ * screenshotConnector: 'connector.js'
1739
+ * }
1740
+ * }
1741
+ * ```
1742
+ *
1743
+ * Will result in the following file structure:
1744
+ * ```tree
1745
+ * stencil-project-root
1746
+ * └── .cache
1747
+ * ├── .build <-- Where build related file caching is written
1748
+ * |
1749
+ * └── screenshot-cache.json <-- Where screenshot caching is written
1750
+ * ```
1751
+ */
1752
+ cacheDir?: string;
1753
+ /**
1754
+ * Stencil is traditionally used to compile many components into an app,
1755
+ * and each component comes with its own compartmentalized styles.
1756
+ * However, it's still common to have styles which should be "global" across all components and the website.
1757
+ * A global CSS file is often useful to set CSS Variables.
1758
+ *
1759
+ * Additionally, the globalStyle config can be used to precompile styles with Sass, PostCSS, etc.
1760
+ * Below is an example folder structure containing a webapp's global sass file, named app.css.
1761
+ */
1762
+ globalStyle?: string;
1763
+ /**
1764
+ * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
1765
+ * for each component in the build when `true`.
1766
+ *
1767
+ * @default false
1768
+ */
1769
+ generateExportMaps?: boolean;
1770
+ /**
1771
+ * The namespace config is a string representing a namespace for the app.
1772
+ * For apps that are not meant to be a library of reusable components,
1773
+ * the default of App is just fine. However, if the app is meant to be consumed
1774
+ * as a third-party library, such as Ionic, a unique namespace is required.
1775
+ */
1776
+ namespace?: string;
1777
+ /**
1778
+ * Stencil is able to take an app's source and compile it to numerous targets,
1779
+ * such as an app to be deployed on an http server, or as a third-party library
1780
+ * to be distributed on npm. By default, Stencil apps have an output target type of www.
1781
+ *
1782
+ * The outputTargets config is an array of objects, with types of www and dist.
1783
+ */
1784
+ outputTargets?: OutputTarget[];
1785
+ /**
1786
+ * The plugins config can be used to add your own rolldown plugins.
1787
+ * By default, Stencil does not come with Sass or PostCSS support.
1788
+ * However, either can be added using the plugin array.
1789
+ */
1790
+ plugins?: any[];
1791
+ /**
1792
+ * Generate js source map files for all bundles.
1793
+ * Set to `true` to always generate source maps, `false` to never generate source maps.
1794
+ * Set to `'dev'` to only generate source maps when the `--dev` flag is passed.
1795
+ * Defaults to `'dev'`.
1796
+ */
1797
+ sourceMap?: boolean | 'dev';
1798
+ /**
1799
+ * The srcDir config specifies the directory which should contain the source typescript files
1800
+ * for each component. The standard for Stencil apps is to use src, which is the default.
1801
+ */
1802
+ srcDir?: string;
1803
+ /**
1804
+ * Sets whether or not Stencil should transform path aliases set in a project's
1805
+ * `tsconfig.json` from the assigned module aliases to resolved relative paths.
1806
+ *
1807
+ * This behavior defaults to `true`, but may be opted-out of by setting this flag to `false`.
1808
+ */
1809
+ transformAliasedImportPaths?: boolean;
1810
+ /**
1811
+ * When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
1812
+ * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1813
+ */
1814
+ suppressReservedPublicNameWarnings?: boolean;
1815
+ /**
1816
+ * When `true`, Stencil will suppress diagnostics which warn about event names conflicting with native DOM event names. Defaults to `false`.
1817
+ */
1818
+ suppressReservedEventNameWarnings?: boolean;
1819
+ /**
1820
+ * Passes custom configuration down to the "@rolldown/plugin-node-resolve" that Stencil uses under the hood.
1821
+ * For further information: https://stenciljs.com/docs/module-bundling
1822
+ */
1823
+ nodeResolve?: NodeResolveConfig;
1824
+ /**
1825
+ * Passes custom configuration down to rolldown itself, not all rolldown options can be overridden.
1826
+ */
1827
+ rolldownConfig?: RolldownConfig;
1828
+ /**
1829
+ * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
1830
+ * Defaults to `false` in dev mode and `true` in production mode.
1831
+ */
1832
+ minifyJs?: boolean;
1833
+ /**
1834
+ * Sets if the CSS is minified or not.
1835
+ * Defaults to `false` in dev mode and `true` in production mode.
1836
+ */
1837
+ minifyCss?: boolean;
1838
+ /**
1839
+ * Object to provide a custom logger. By default a `logger` is already provided for the
1840
+ * platform the compiler is running on, such as NodeJS or a browser.
1841
+ */
1842
+ logger?: Logger;
1843
+ /**
1844
+ * Compatibility and workaround flags for framework integration and bundler edge cases.
1845
+ */
1846
+ compat?: ConfigCompat;
1847
+ /**
1848
+ * Replace `@State` and `@Prop` internals with `@preact/signals-core` signal primitives.
1849
+ * Enables cross-framework reactive interop - component state becomes subscribable by
1850
+ * Solid, Angular, Preact and any TC39-signal-compatible library without event/attribute
1851
+ * roundtrips. No API changes required in component code.
1852
+ * Defaults to `false`.
1853
+ */
1854
+ signalBacking?: boolean;
1855
+ /**
1856
+ * The hydrated flag identifies if a component and all of its child components
1857
+ * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
1858
+ * as various components are asynchronously downloaded and rendered. By default it
1859
+ * will add the `hydrated` CSS class to the element. The `hydratedFlag` config can be used
1860
+ * to change the name of the CSS class, change it to an attribute, or change which
1861
+ * type of CSS properties and values are assigned before and after hydrating. This config
1862
+ * can also be used to not include the hydrated flag at all by setting it to `null`.
1863
+ */
1864
+ hydratedFlag?: HydratedFlag | null;
1865
+ /**
1866
+ * Ionic prefers to hide all components prior to hydration with a style tag appended
1867
+ * to the head of the document containing some `visibility: hidden;` css rules.
1868
+ *
1869
+ * Disabling this will remove the style tag that sets `visibility: hidden;` on all
1870
+ * un-hydrated web components. This more closely follows the HTML spec, and allows
1871
+ * you to set your own fallback content.
1872
+ *
1873
+ */
1874
+ invisiblePrehydration?: boolean;
1875
+ /**
1876
+ * Sets the task queue used by stencil's runtime. The task queue schedules DOM read and writes
1877
+ * across the frames to efficiently render and reduce layout thrashing. By default,
1878
+ * `async` is used. It's recommended to also try each setting to decide which works
1879
+ * best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
1880
+ * main thread to periodically lock-up, it's always recommended to try
1881
+ * [Web Workers](https://stenciljs.com/docs/web-workers) for those tasks.
1882
+ *
1883
+ * - `async`: DOM read and writes are scheduled in the next frame to prevent layout thrashing.
1884
+ * During intensive CPU tasks it will not reschedule rendering to happen in the next frame.
1885
+ * `async` is ideal for most apps, and if the app has many intensive tasks causing the main
1886
+ * thread to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers)
1887
+ * rather than the congestion async queue.
1888
+ *
1889
+ * - `congestionAsync`: DOM reads and writes are scheduled in the next frame to prevent layout
1890
+ * thrashing. When the app is heavily tasked and the queue becomes congested it will then
1891
+ * split the work across multiple frames to prevent blocking the main thread. However, it can
1892
+ * also introduce unnecessary reflows in some cases, especially during startup. `congestionAsync`
1893
+ * is ideal for apps running animations while also simultaneously executing intensive tasks
1894
+ * which may lock-up the main thread.
1895
+ *
1896
+ * - `immediate`: Makes writeTask() and readTask() callbacks to be executed synchronously. Tasks
1897
+ * are not scheduled to run in the next frame, but do note there is at least one microtask.
1898
+ * The `immediate` setting is ideal for apps that do not provide long running and smooth
1899
+ * animations. Like the async setting, if the app has intensive tasks causing the main thread
1900
+ * to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers).
1901
+ */
1902
+ taskQueue?: 'async' | 'immediate' | 'congestionAsync';
1903
+ /**
1904
+ * Provide a object of key/values accessible within the app, using the `Env` object.
1905
+ */
1906
+ env?: {
1907
+ [prop: string]: string | undefined;
1908
+ };
1909
+ docs?: StencilDocsConfig;
1910
+ globalScript?: string;
1911
+ srcIndexHtml?: string;
1912
+ maxConcurrentWorkers?: number;
1913
+ preamble?: string;
1914
+ rolldownPlugins?: {
1915
+ before?: any[];
1916
+ after?: any[];
1917
+ };
1918
+ entryComponentsHint?: string[];
1919
+ buildLogFilePath?: string;
1920
+ devInspector?: boolean;
1921
+ devServer?: StencilDevServerConfig;
1922
+ sys?: CompilerSystem;
1923
+ tsconfig?: string;
1924
+ validateTypes?: boolean;
1925
+ /**
1926
+ * Sets whether Stencil will watch for changes in the source files and rebuild the project automatically.
1927
+ * @default true
1928
+ */
1929
+ watch?: boolean;
1930
+ /**
1931
+ * External directories to watch for changes. By default, Stencil will watch the root and {@link StencilConfig.srcDir}
1932
+ * directory for changes. If you want to watch additional directories, including e.g. `node_modules`, you can add them here.
1933
+ * @default []
1934
+ */
1935
+ watchExternalDirs?: string[];
1936
+ /**
1937
+ * An array of RegExp patterns that are matched against all source files before adding
1938
+ * to the watch list in watch mode. If the file path matches any of the patterns, when it
1939
+ * is updated, it will not trigger a re-run of tests.
1940
+ */
1941
+ watchIgnoredRegex?: RegExp | RegExp[];
1942
+ /**
1943
+ * An array of component tag names to exclude from production builds.
1944
+ * Useful to remove test, demo or experimental components from final output.
1945
+ *
1946
+ * **Note:** Exclusion only applies to production builds (the default).
1947
+ * Development builds (with `--dev` flag) will include all components to support local testing.
1948
+ *
1949
+ * Supports glob patterns for matching multiple components:
1950
+ * - `['demo-*']` - Excludes all components starting with "demo-"
1951
+ * - `['*-test', '*-demo']` - Excludes components ending with "-test" or "-demo"
1952
+ * - `['my-component']` - Excludes a specific component
1953
+ *
1954
+ * Components matching these patterns will be completely excluded from all output targets.
1955
+ *
1956
+ * @example
1957
+ * ```ts
1958
+ * export const config: Config = {
1959
+ * excludeComponents: ['demo-*', 'test-component', '*-internal'],
1960
+ * };
1961
+ * ```
1962
+ *
1963
+ * @default []
1964
+ */
1965
+ excludeComponents?: string[];
1966
+ /**
1967
+ * Set whether unused dependencies should be excluded from the built output.
1968
+ */
1969
+ excludeUnusedDependencies?: boolean;
1970
+ /**
1971
+ * Explicitly declare which npm packages are Stencil collections to be re-bundled into this project.
1972
+ *
1973
+ * Without this option, collection ingestion is triggered only by a side-effect import:
1974
+ * ```ts
1975
+ * import '@ionic/core';
1976
+ * ```
1977
+ * @example
1978
+ * ```ts
1979
+ * export const config: Config = {
1980
+ * collections: ['@ionic/core', '@my-org/design-system'],
1981
+ * };
1982
+ * ```
1983
+ *
1984
+ * @default []
1985
+ */
1986
+ collections?: string[];
1987
+ stencilCoreResolvedId?: string;
1988
+ }
1989
+ /**
1990
+ * DOM patches for light-dom / scoped components that use `<slot>`.
1991
+ *
1992
+ * These patches shield the component's slot machinery from framework DOM mutations
1993
+ * (e.g. when Angular or React insert / remove nodes they route directly to the host
1994
+ * element, bypassing the slot polyfill) and prevent hydration errors when a framework
1995
+ * encounters Stencil's internal slot reference nodes during SSR reconciliation.
1996
+ *
1997
+ * Patches are only applied at runtime when a component is both non-shadow **and**
1998
+ * declares at least one `<slot>`, so enabling them has no effect on pure shadow-DOM
1999
+ * components.
2000
+ *
2001
+ * Set to `true` (default) to enable all patches, `false` to disable all, or an object
2002
+ * for granular control.
2003
+ */
2004
+ type LightDomPatches = {
2005
+ /** Patches `childNodes`/`children` getters to return only slotted content. */childNodes?: boolean; /** Patches `cloneNode()` to correctly deep-clone slotted content. */
2006
+ cloneNode?: boolean; /** Patches `appendChild()`, `insertBefore()`, and `removeChild()` to route to the correct slot. */
2007
+ domMutations?: boolean; /** Patches `textContent` to act like shadow DOM (reads/writes slotted text only). */
2008
+ textContent?: boolean;
2009
+ };
2010
+ /**
2011
+ * Compatibility and workaround flags for framework integration and bundler edge cases.
2012
+ * These are opt-in runtime behaviors that aren't needed by every project.
2013
+ */
2014
+ interface ConfigCompat {
2015
+ /**
2016
+ * Projects that use a Stencil library built using the `dist` output target may have trouble lazily
2017
+ * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
2018
+ * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
2019
+ * the size of the compiled output. Defaults to `true`.
2020
+ */
2021
+ enableImportInjection?: boolean;
2022
+ /**
2023
+ * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
2024
+ */
2025
+ lifecycleDOMEvents?: boolean;
2026
+ /**
2027
+ * When a component is first attached to the DOM, this setting will wait a single tick before
2028
+ * rendering. This works around an Angular issue, where Angular attaches the elements before
2029
+ * settings their initial state, leading to double renders and unnecessary event dispatches.
2030
+ * Defaults to `false`.
2031
+ */
2032
+ initializeNextTick?: boolean;
2033
+ /**
2034
+ * Adds `transformTag` calls to css strings and querySelector(All) calls.
2035
+ * Use `'prod'` to enable only in production builds.
2036
+ */
2037
+ additionalTagTransformers?: boolean | 'prod';
2038
+ /**
2039
+ * DOM patches for light-dom / scoped components that use `<slot>`.
2040
+ * See {@link LightDomPatches} for granular control. Defaults to `true`.
2041
+ */
2042
+ lightDomPatches?: boolean | LightDomPatches;
2043
+ }
2044
+ interface Config extends StencilConfig {
2045
+ buildAppCore?: boolean;
2046
+ configPath?: string;
2047
+ writeLog?: boolean;
2048
+ devServer?: DevServerConfig;
2049
+ fsNamespace?: string;
2050
+ logLevel?: LogLevel;
2051
+ rootDir?: string;
2052
+ packageJsonFilePath?: string;
2053
+ suppressLogs?: boolean;
2054
+ profile?: boolean;
2055
+ tsCompilerOptions?: any;
2056
+ tsWatchOptions?: any;
2057
+ _isValidated?: boolean;
2058
+ _isTesting?: boolean;
2059
+ /**
2060
+ * Internal flag set when --docs CLI flag is used.
2061
+ * Forces docs output targets to build even in dev mode.
2062
+ */
2063
+ _docsFlag?: boolean;
2064
+ /**
2065
+ * Whether running in a CI environment (disables interactive features, adjusts worker count)
2066
+ */
2067
+ ci?: boolean;
2068
+ /**
2069
+ * Enable server-side rendering mode
2070
+ */
2071
+ ssr?: boolean;
2072
+ /**
2073
+ * Enable prerendering
2074
+ */
2075
+ prerender?: boolean;
2076
+ /**
2077
+ * Path to output docs JSON file (when --docsJson flag is used)
2078
+ */
2079
+ docsJsonPath?: string;
2080
+ /**
2081
+ * Path to output stats JSON file, or true to use default path
2082
+ */
2083
+ statsJsonPath?: string | boolean;
2084
+ /**
2085
+ * Whether to generate service worker
2086
+ */
2087
+ generateServiceWorker?: boolean;
2088
+ /**
2089
+ * Dev server address override
2090
+ */
2091
+ devServerAddress?: string;
2092
+ /**
2093
+ * Dev server port override
2094
+ */
2095
+ devServerPort?: number;
2096
+ /**
2097
+ * Whether to open browser on dev server start
2098
+ */
2099
+ devServerOpen?: boolean;
2100
+ }
2101
+ /**
2102
+ * A 'loose' type useful for wrapping an incomplete / possible malformed
2103
+ * object as we work on getting it comply with a particular Interface T.
2104
+ *
2105
+ * Example:
2106
+ *
2107
+ * ```ts
2108
+ * interface Foo {
2109
+ * bar: string
2110
+ * }
2111
+ *
2112
+ * function validateFoo(foo: Loose<Foo>): Foo {
2113
+ * let validatedFoo = {
2114
+ * ...foo,
2115
+ * bar: foo.bar || DEFAULT_BAR
2116
+ * }
2117
+ *
2118
+ * return validatedFoo
2119
+ * }
2120
+ * ```
2121
+ *
2122
+ * Use this when you need to take user input or something from some other part
2123
+ * of the world that we don't control and transform it into something
2124
+ * conforming to a given interface. For best results, pair with a validation
2125
+ * function as shown in the example.
2126
+ */
2127
+ type Loose<T extends object> = Record<string, any> & Partial<T>;
2128
+ /**
2129
+ * A Loose version of the Config interface. This is intended to let us load a partial config
2130
+ * and have type information carry though as we construct an object which is a valid `Config`.
2131
+ */
2132
+ type UnvalidatedConfig = Loose<Config>;
2133
+ /**
2134
+ * Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
2135
+ * This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
2136
+ *
2137
+ * ```typescript
2138
+ * type Foo { bar?: number, baz?: string }
2139
+ * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
2140
+ * ```
2141
+ */
2142
+ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
2143
+ /**
2144
+ * Fields in {@link Config} to make required for {@link ValidatedConfig}
2145
+ */
2146
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2147
+ /**
2148
+ * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2149
+ * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
2150
+ * about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
2151
+ * validations have occurred at runtime.
2152
+ */
2153
+ type ValidatedConfig = RequireFields<Config, StrictConfigFields> & {
2154
+ /**
2155
+ * Whether the build is running in development mode.
2156
+ * Set by the `--dev` CLI flag. Not user-configurable in `stencil.config.ts`.
2157
+ */
2158
+ devMode: boolean;
2159
+ sourceMap: boolean;
2160
+ };
2161
+ interface HydratedFlag {
2162
+ /**
2163
+ * Defaults to `hydrated`.
2164
+ */
2165
+ name?: string;
2166
+ /**
2167
+ * Can be either `class` or `attribute`. Defaults to `class`.
2168
+ */
2169
+ selector?: 'class' | 'attribute';
2170
+ /**
2171
+ * The CSS property used to show and hide components. Defaults to use the CSS `visibility`
2172
+ * property. Other commonly used CSS properties would be `display` with the `initialValue`
2173
+ * setting as `none`, or `opacity` with the `initialValue` as `0`. Defaults to `visibility`
2174
+ * and the default `initialValue` is `hidden`.
2175
+ */
2176
+ property?: string;
2177
+ /**
2178
+ * This is the CSS value to give all components before it has been hydrated.
2179
+ * Defaults to `hidden`.
2180
+ */
2181
+ initialValue?: string;
2182
+ /**
2183
+ * This is the CSS value to assign once a component has finished hydrating.
2184
+ * This is the CSS value that'll allow the component to show. Defaults to `inherit`.
2185
+ */
2186
+ hydratedValue?: string;
2187
+ }
2188
+ interface StencilDevServerConfig {
2189
+ /**
2190
+ * IP address used by the dev server. The default is `0.0.0.0`, which points to all IPv4 addresses
2191
+ * on the local machine, such as `localhost`.
2192
+ */
2193
+ address?: string;
2194
+ /**
2195
+ * Base path to be used by the server. Defaults to the root pathname.
2196
+ */
2197
+ basePath?: string;
2198
+ /**
2199
+ * EXPERIMENTAL!
2200
+ * During development, node modules can be independently requested and bundled, making for
2201
+ * faster build times. This is only available using the Stencil Dev Server throughout
2202
+ * development. Production builds will override this setting to `false`. Default is `false`.
2203
+ */
2204
+ experimentalDevModules?: boolean;
2205
+ /**
2206
+ * If the dev server should respond with gzip compressed content. Defaults to `true`.
2207
+ */
2208
+ gzip?: boolean;
2209
+ /**
2210
+ * When set, the dev server will run via https using the SSL certificate and key you provide
2211
+ * (use `fs` if you want to read them from files).
2212
+ */
2213
+ https?: Credentials;
2214
+ /**
2215
+ * The URL the dev server should first open to. Defaults to `/`.
2216
+ */
2217
+ initialLoadUrl?: string;
2218
+ /**
2219
+ * When `true`, every request to the server will be logged within the terminal.
2220
+ * Defaults to `false`.
2221
+ */
2222
+ logRequests?: boolean;
2223
+ /**
2224
+ * When set to `true`, the local dev URL is opened in your default browser when the dev server starts.
2225
+ * Defaults to `false`.
2226
+ */
2227
+ openBrowser?: boolean;
2228
+ /**
2229
+ * Sets the server's port. Defaults to `3333`.
2230
+ */
2231
+ port?: number;
2232
+ /**
2233
+ * When set to `true`, the dev server will exit with an error if the specified port is already in use.
2234
+ * When set to `false`, the dev server will automatically try the next available port.
2235
+ * Defaults to `false`.
2236
+ */
2237
+ strictPort?: boolean;
2238
+ /**
2239
+ * When files are watched and updated, by default the dev server will use `hmr` (Hot Module Replacement)
2240
+ * to update the page without a full page refresh. To have the page do a full refresh use `pageReload`.
2241
+ * To disable any reloading, use `null`. Defaults to `hmr`.
2242
+ */
2243
+ reloadStrategy?: PageReloadStrategy;
2244
+ /**
2245
+ * Local path to a NodeJs file with a dev server request listener as the default export.
2246
+ * The user's request listener is given the first chance to handle every request the dev server
2247
+ * receives, and can choose to handle it or instead pass it on to the default dev server
2248
+ * by calling `next()`.
2249
+ *
2250
+ * Below is an example of a NodeJs file the `requestListenerPath` config is using.
2251
+ * The request and response arguments are the same as Node's `http` module and `RequestListener`
2252
+ * callback. https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener
2253
+ *
2254
+ * ```js
2255
+ * module.exports = function (req, res, next) {
2256
+ * if (req.url === '/ping') {
2257
+ * // custom response overriding the dev server
2258
+ * res.setHeader('Content-Type', 'text/plain');
2259
+ * res.writeHead(200);
2260
+ * res.end('pong');
2261
+ * } else {
2262
+ * // pass request on to the default dev server
2263
+ * next();
2264
+ * }
2265
+ * };
2266
+ * ```
2267
+ */
2268
+ requestListenerPath?: string;
2269
+ /**
2270
+ * The root directory to serve the files from.
2271
+ */
2272
+ root?: string;
2273
+ /**
2274
+ * If the dev server should Server-Side Render (SSR) each page, meaning it'll dynamically generate
2275
+ * server-side rendered html on each page load. The `--ssr` flag will most commonly be used with
2276
+ * the`--dev --watch --serve` flags during development. Note that this is for development purposes
2277
+ * only, and the built-in dev server should not be used for production. Defaults to `false`.
2278
+ */
2279
+ ssr?: boolean;
2280
+ /**
2281
+ * If the dev server fails to start up within the given timeout (in milliseconds), the startup will
2282
+ * be canceled. Set to zero to disable the timeout. Defaults to `15000`.
2283
+ */
2284
+ startupTimeout?: number;
2285
+ /**
2286
+ * Whether to use the dev server's websocket client or not. Defaults to `true`.
2287
+ */
2288
+ websocket?: boolean;
2289
+ /**
2290
+ * If the dev server should fork a worker for the server process or not. A singled-threaded dev server
2291
+ * is slower, however it is useful for debugging http requests and responses. Defaults to `true`.
2292
+ */
2293
+ worker?: boolean;
2294
+ }
2295
+ interface DevServerConfig extends StencilDevServerConfig {
2296
+ browserUrl?: string;
2297
+ devServerDir?: string;
2298
+ /**
2299
+ * A list of glob patterns like `subdir/*.js` to exclude from hot-module
2300
+ * reloading updates.
2301
+ */
2302
+ excludeHmr?: string[];
2303
+ historyApiFallback?: HistoryApiFallback;
2304
+ openBrowser?: boolean;
2305
+ prerenderConfig?: string;
2306
+ protocol?: 'http' | 'https';
2307
+ srcIndexHtml?: string;
2308
+ /**
2309
+ * Route to be used for the "ping" sub-route of the Stencil dev server.
2310
+ * This route will return a 200 status code once the Stencil build has finished.
2311
+ * Setting this to `null` will disable the ping route.
2312
+ *
2313
+ * Defaults to `/ping`
2314
+ */
2315
+ pingRoute?: string | null;
2316
+ }
2317
+ interface HistoryApiFallback {
2318
+ index?: string;
2319
+ disableDotRule?: boolean;
2320
+ }
2321
+ interface DevServerEditor {
2322
+ id: string;
2323
+ name?: string;
2324
+ supported?: boolean;
2325
+ priority?: number;
2326
+ }
2327
+ type PageReloadStrategy = 'hmr' | 'pageReload' | null;
2328
+ /**
2329
+ * The prerender config is used when prerendering a `www` output target.
2330
+ * Within `stencil.config.ts`, set the path to the prerendering
2331
+ * config file path using the `prerenderConfig` property, such as:
2332
+ *
2333
+ * ```tsx
2334
+ * import { Config } from '@stencil/core';
2335
+ * export const config: Config = {
2336
+ * outputTargets: [
2337
+ * {
2338
+ * type: 'www',
2339
+ * baseUrl: 'https://stenciljs.com/',
2340
+ * prerenderConfig: './prerender.config.ts',
2341
+ * }
2342
+ * ]
2343
+ * };
2344
+ * ```
2345
+ *
2346
+ * The `prerender.config.ts` should export a `config` object using
2347
+ * the `PrerenderConfig` interface.
2348
+ *
2349
+ * ```tsx
2350
+ * import { PrerenderConfig } from '@stencil/core';
2351
+ * export const config: PrerenderConfig = {
2352
+ * ...
2353
+ * };
2354
+ * ```
2355
+ *
2356
+ * For more info: https://stenciljs.com/docs/static-site-generation
2357
+ */
2358
+ interface PrerenderConfig {
2359
+ /**
2360
+ * Run after each `document` is hydrated, but before it is serialized
2361
+ * into an HTML string. Hook is passed the `document` and its `URL`.
2362
+ */
2363
+ afterSsr?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2364
+ /**
2365
+ * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
2366
+ */
2367
+ beforeSsr?(document: Document, url: URL): any | Promise<any>;
2368
+ /**
2369
+ * Runs after the template Document object has serialize into an
2370
+ * HTML formatted string. Returns an HTML string to be used as the
2371
+ * base template for all prerendered pages.
2372
+ */
2373
+ afterSerializeTemplate?(html: string): string | Promise<string>;
2374
+ /**
2375
+ * Runs before the template Document object is serialize into an
2376
+ * HTML formatted string. Returns the Document to be serialized which
2377
+ * will become the base template html for all prerendered pages.
2378
+ */
2379
+ beforeSerializeTemplate?(document: Document): Document | Promise<Document>;
2380
+ /**
2381
+ * A hook to be used to generate the canonical `<link>` tag
2382
+ * which goes in the `<head>` of every prerendered page. Returning `null`
2383
+ * will not add a canonical url tag to the page.
2384
+ */
2385
+ canonicalUrl?(url: URL): string | null;
2386
+ /**
2387
+ * While prerendering, crawl same-origin URLs found within `<a href>` elements.
2388
+ * Defaults to `true`.
2389
+ */
2390
+ crawlUrls?: boolean;
2391
+ /**
2392
+ * URLs to start the prerendering from. By default the root URL of `/` is used.
2393
+ */
2394
+ entryUrls?: string[];
2395
+ /**
2396
+ * Return `true` the given `<a>` element should be crawled or not.
2397
+ */
2398
+ filterAnchor?(attrs: {
2399
+ [attrName: string]: string;
2400
+ }, base?: URL): boolean;
2401
+ /**
2402
+ * Return `true` if the given URL should be prerendered or not.
2403
+ */
2404
+ filterUrl?(url: URL, base: URL): boolean;
2405
+ /**
2406
+ * Returns the file path which the prerendered HTML content
2407
+ * should be written to.
2408
+ */
2409
+ filePath?(url: URL, filePath: string): string;
2410
+ /**
2411
+ * Returns the prerender options to use for each individual prerendered page.
2412
+ */
2413
+ prerenderOptions?(url: URL): PrerenderOptions;
2414
+ /**
2415
+ * Returns the template file's content. The template is the base
2416
+ * HTML used for all prerendered pages.
2417
+ */
2418
+ loadTemplate?(filePath: string): string | Promise<string>;
2419
+ /**
2420
+ * Used to normalize the page's URL from a given a string and the current
2421
+ * page's base URL. Largely used when reading an anchor's `href` attribute
2422
+ * value and normalizing it into a `URL`.
2423
+ */
2424
+ normalizeUrl?(href: string, base: URL): URL;
2425
+ robotsTxt?(opts: RobotsTxtOpts): string | RobotsTxtResults;
2426
+ sitemapXml?(opts: SitemapXmpOpts): string | SitemapXmpResults;
2427
+ /**
2428
+ * Static Site Generated (SSG). Does not include Stencil's client-side
2429
+ * JavaScript, custom elements or preload modules.
2430
+ */
2431
+ staticSite?: boolean;
2432
+ /**
2433
+ * If the prerendered URLs should have a trailing "/"" or not. Defaults to `false`.
2434
+ */
2435
+ trailingSlash?: boolean;
2436
+ }
2437
+ interface SsrDocumentOptions {
2438
+ /**
2439
+ * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
2440
+ * a random ID will be generated
2441
+ */
2442
+ buildId?: string;
2443
+ /**
2444
+ * Sets the `href` attribute on the `<link rel="canonical">`
2445
+ * tag within the `<head>`. If the value is not defined it will
2446
+ * ensure a canonical link tag is no included in the `<head>`.
2447
+ */
2448
+ canonicalUrl?: string;
2449
+ /**
2450
+ * Include the HTML comments and attributes used by the client-side
2451
+ * JavaScript to read the structure of the HTML and rebuild each
2452
+ * component. Defaults to `true`.
2453
+ */
2454
+ clientSsrAnnotations?: boolean;
2455
+ /**
2456
+ * Constrain `setTimeout()` to 1ms, but still async. Also
2457
+ * only allows `setInterval()` to fire once, also constrained to 1ms.
2458
+ * Defaults to `true`.
2459
+ */
2460
+ constrainTimeouts?: boolean;
2461
+ /**
2462
+ * Sets `document.cookie`
2463
+ */
2464
+ cookie?: string;
2465
+ /**
2466
+ * Sets the `dir` attribute on the top level `<html>`.
2467
+ */
2468
+ direction?: string;
2469
+ /**
2470
+ * Component tag names listed here will not be prerendered, nor will
2471
+ * hydrated on the client-side. Components listed here will be ignored
2472
+ * as custom elements and treated no differently than a `<div>`.
2473
+ */
2474
+ excludeComponents?: string[];
2475
+ /**
2476
+ * Sets the `lang` attribute on the top level `<html>`.
2477
+ */
2478
+ language?: string;
2479
+ /**
2480
+ * Maximum number of components to hydrate on one page. Defaults to `300`.
2481
+ */
2482
+ maxHydrateCount?: number;
2483
+ /**
2484
+ * Sets `document.referrer`
2485
+ */
2486
+ referrer?: string;
2487
+ /**
2488
+ * Removes every `<script>` element found in the `document`. Defaults to `false`.
2489
+ */
2490
+ removeScripts?: boolean;
2491
+ /**
2492
+ * Removes CSS not used by elements within the `document`. Defaults to `true`.
2493
+ */
2494
+ removeUnusedStyles?: boolean;
2495
+ /**
2496
+ * The url the runtime uses for the resources, such as the assets directory.
2497
+ */
2498
+ resourcesUrl?: string;
2499
+ /**
2500
+ * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
2501
+ */
2502
+ runtimeLogging?: boolean;
2503
+ /**
2504
+ * Component tags listed here will only be prerendered or server-side-rendered
2505
+ * and will not be client-side hydrated. This is useful for components that
2506
+ * are not dynamic and do not need to be defined as a custom element within the
2507
+ * browser. For example, a header or footer component would be a good example that
2508
+ * may not require any client-side JavaScript.
2509
+ */
2510
+ staticComponents?: string[];
2511
+ /**
2512
+ * The amount of milliseconds to wait for a page to finish rendering until
2513
+ * a timeout error is thrown. Defaults to `15000`.
2514
+ */
2515
+ timeout?: number;
2516
+ /**
2517
+ * Sets `document.title`.
2518
+ */
2519
+ title?: string;
2520
+ /**
2521
+ * Sets `location.href`
2522
+ */
2523
+ url?: string;
2524
+ /**
2525
+ * Sets `navigator.userAgent`
2526
+ */
2527
+ userAgent?: string;
2528
+ /**
2529
+ * Configure how Stencil serializes the components shadow root.
2530
+ * - If set to `declarative-shadow-dom` the component will be rendered within a Declarative Shadow DOM.
2531
+ * - If set to `scoped` Stencil will render the contents of the shadow root as a `scoped: true` component
2532
+ * and the shadow DOM will be created during client-side hydration.
2533
+ * - Alternatively you can mix and match the two by providing an object with `declarative-shadow-dom` and `scoped` keys,
2534
+ * the value arrays containing the tag names of the components that should be rendered in that mode.
2535
+ *
2536
+ * Examples:
2537
+ * - `{ 'declarative-shadow-dom': ['my-component-1', 'another-component'], default: 'scoped' }`
2538
+ * Render all components as `scoped` apart from `my-component-1` and `another-component`
2539
+ * - `{ 'scoped': ['an-option-component'], default: 'declarative-shadow-dom' }`
2540
+ * Render all components within `declarative-shadow-dom` apart from `an-option-component`
2541
+ * - `'scoped'` Render all components as `scoped`
2542
+ * - `false` disables shadow root serialization
2543
+ *
2544
+ * *NOTE* `true` has been deprecated in favor of `declarative-shadow-dom` and `scoped`
2545
+ * @default 'declarative-shadow-dom'
2546
+ */
2547
+ serializeShadowRoot?: 'declarative-shadow-dom' | 'scoped' | {
2548
+ 'declarative-shadow-dom'?: string[];
2549
+ scoped?: string[];
2550
+ default: 'declarative-shadow-dom' | 'scoped';
2551
+ } | boolean;
2552
+ }
2553
+ /**
2554
+ * Backwards compat for v4
2555
+ * @deprecated - use SsrDocumentOptions instead
2556
+ */
2557
+ interface HydrateDocumentOptions extends SsrDocumentOptions {}
2558
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
2559
+ /**
2560
+ * Runs after the `document` has been hydrated.
2561
+ */
2562
+ afterSsr?(document: any): any | Promise<any>;
2563
+ /**
2564
+ * @deprecated Use `afterSsr` instead.
2565
+ */
2566
+ afterHydrate?(document: any): any | Promise<any>;
2567
+ /**
2568
+ * Sets an approximate line width the HTML should attempt to stay within.
2569
+ * Note that this is "approximate", in that HTML may often not be able
2570
+ * to be split at an exact line width. Additionally, new lines created
2571
+ * is where HTML naturally already has whitespace, such as before an
2572
+ * attribute or spaces between words. Defaults to `100`.
2573
+ */
2574
+ approximateLineWidth?: number;
2575
+ /**
2576
+ * Runs before the `document` has been hydrated.
2577
+ */
2578
+ beforeSsr?(document: any): any | Promise<any>;
2579
+ /**
2580
+ * @deprecated Use `beforeSsr` instead.
2581
+ */
2582
+ beforeHydrate?(document: any): any | Promise<any>;
2583
+ /**
2584
+ * Format the HTML in a nicely indented format.
2585
+ * Defaults to `false`.
2586
+ */
2587
+ prettyHtml?: boolean;
2588
+ /**
2589
+ * Remove quotes from attribute values when possible.
2590
+ * Defaults to `true`.
2591
+ */
2592
+ removeAttributeQuotes?: boolean;
2593
+ /**
2594
+ * Remove the `=""` from standardized `boolean` attributes,
2595
+ * such as `hidden` or `checked`. Defaults to `true`.
2596
+ */
2597
+ removeBooleanAttributeQuotes?: boolean;
2598
+ /**
2599
+ * Remove these standardized attributes when their value is empty:
2600
+ * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
2601
+ */
2602
+ removeEmptyAttributes?: boolean;
2603
+ /**
2604
+ * Remove HTML comments. Defaults to `true`.
2605
+ */
2606
+ removeHtmlComments?: boolean;
2607
+ /**
2608
+ * The `fullDocument` flag determines the format of the rendered output. Set it to true to
2609
+ * generate a complete HTML document, or false to render only the component.
2610
+ * @default true
2611
+ */
2612
+ fullDocument?: boolean;
2613
+ /**
2614
+ * Style modes to render the component in.
2615
+ * @see https://stenciljs.com/docs/styling#style-modes
2616
+ */
2617
+ modes?: ResolutionHandler[];
2618
+ }
2619
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
2620
+ serializeToHtml: boolean;
2621
+ destroyWindow: boolean;
2622
+ destroyDocument: boolean;
2623
+ }
2624
+ /**
2625
+ * Backwards compat for v4
2626
+ * @deprecated - use SsrFactoryOptions instead
2627
+ */
2628
+ interface HydrateFactoryOptions extends SsrFactoryOptions {}
2629
+ interface PrerenderOptions extends SerializeDocumentOptions {
2630
+ /**
2631
+ * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
2632
+ * Defaults to `true`.
2633
+ */
2634
+ addModulePreloads?: boolean;
2635
+ /**
2636
+ * Hash the content of assets, such as images, fonts and css files,
2637
+ * and add the hashed value as `v` querystring. For example,
2638
+ * `/assets/image.png?v=abcd1234`. This allows for assets to be
2639
+ * heavily cached by setting the server's response header with
2640
+ * `Cache-Control: max-age=31536000, immutable`.
2641
+ */
2642
+ hashAssets?: 'querystring';
2643
+ /**
2644
+ * External stylesheets from `<link rel="stylesheet">` are instead inlined
2645
+ * into `<style>` elements. Defaults to `false`.
2646
+ */
2647
+ inlineExternalStyleSheets?: boolean;
2648
+ /**
2649
+ * Minify CSS content within `<style>` elements. Defaults to `true`.
2650
+ */
2651
+ minifyStyleElements?: boolean;
2652
+ /**
2653
+ * Minify JavaScript content within `<script>` elements. Defaults to `true`.
2654
+ */
2655
+ minifyScriptElements?: boolean;
2656
+ /**
2657
+ * Entire `document` should be static. This is useful for specific pages that
2658
+ * should be static, rather than the entire site. If the whole site should be static,
2659
+ * use the `staticSite` property on the prerender config instead. If only certain
2660
+ * components should be static then use `staticComponents` instead.
2661
+ */
2662
+ staticDocument?: boolean;
2663
+ }
2664
+ /**
2665
+ * v4 backwards compat
2666
+ * @deprecated - use PrerenderOptions instead
2667
+ */
2668
+ interface PrerenderHydrateOptions extends PrerenderOptions {}
2669
+ interface RobotsTxtOpts {
2670
+ urls: string[];
2671
+ sitemapUrl: string;
2672
+ baseUrl: string;
2673
+ dir: string;
2674
+ }
2675
+ interface RobotsTxtResults {
2676
+ content: string;
2677
+ filePath: string;
2678
+ url: string;
2679
+ }
2680
+ interface SitemapXmpOpts {
2681
+ urls: string[];
2682
+ baseUrl: string;
2683
+ dir: string;
2684
+ }
2685
+ interface SitemapXmpResults {
2686
+ content: string;
2687
+ filePath: string;
2688
+ url: string;
2689
+ }
2690
+ /**
2691
+ * Common system used by the compiler. All file reads, writes, access, etc. will all use
2692
+ * this system. Additionally, throughout each build, the compiler will use an internal
2693
+ * in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
2694
+ * build all actions the in-memory fs performed will be written to disk using this system.
2695
+ * A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
2696
+ * will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
2697
+ * of the actual platform it's being ran on top of.
2698
+ */
2699
+ interface CompilerSystem {
2700
+ name: 'node' | 'in-memory';
2701
+ version: string;
2702
+ events?: BuildEvents;
2703
+ details?: SystemDetails;
2704
+ /**
2705
+ * Add a callback which will be ran when destroy() is called.
2706
+ */
2707
+ addDestroy(cb: () => void): void;
2708
+ /**
2709
+ * Always returns a boolean, does not throw.
2710
+ */
2711
+ access(p: string): Promise<boolean>;
2712
+ /**
2713
+ * SYNC! Always returns a boolean, does not throw.
2714
+ */
2715
+ accessSync(p: string): boolean;
2716
+ applyGlobalPatch?(fromDir: string): Promise<void>;
2717
+ applyPrerenderGlobalPatch?(opts: {
2718
+ devServerHostUrl: string;
2719
+ window: any;
2720
+ }): void;
2721
+ cacheStorage?: CacheStorage;
2722
+ checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
2723
+ copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
2724
+ /**
2725
+ * Always returns a boolean if the files were copied or not. Does not throw.
2726
+ */
2727
+ copyFile(src: string, dst: string): Promise<boolean>;
2728
+ /**
2729
+ * Used to destroy any listeners, file watchers or child processes.
2730
+ */
2731
+ destroy(): Promise<void>;
2732
+ /**
2733
+ * Does not throw.
2734
+ */
2735
+ createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
2736
+ /**
2737
+ * SYNC! Does not throw.
2738
+ */
2739
+ createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
2740
+ homeDir(): string;
2741
+ /**
2742
+ * Used to determine if the current context of the terminal is TTY.
2743
+ */
2744
+ isTTY(): boolean;
2745
+ /**
2746
+ * Each platform has a different way to dynamically import modules.
2747
+ */
2748
+ dynamicImport?(p: string): Promise<any>;
2749
+ /**
2750
+ * Creates the worker controller for the current system.
2751
+ *
2752
+ * @param maxConcurrentWorkers the max number of concurrent workers to
2753
+ * support
2754
+ * @returns a worker controller appropriate for the current platform (node.js)
2755
+ */
2756
+ createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
2757
+ encodeToBase64(str: string): string;
2758
+ /**
2759
+ * process.exit()
2760
+ */
2761
+ exit(exitCode: number): Promise<void>;
2762
+ /**
2763
+ * Optionally provide a fetch() function rather than using the built-in fetch().
2764
+ * First arg is a url string or Request object (RequestInfo).
2765
+ * Second arg is the RequestInit. Returns the Response object
2766
+ */
2767
+ fetch?(input: string | any, init?: any): Promise<any>;
2768
+ /**
2769
+ * Generates a sha1 digest encoded as HEX
2770
+ */
2771
+ generateContentHash?(content: string | any, length?: number): Promise<string>;
2772
+ /**
2773
+ * Generates a sha1 digest encoded as HEX from a file path
2774
+ */
2775
+ generateFileHash?(filePath: string | any, length?: number): Promise<string>;
2776
+ /**
2777
+ * Get the current directory.
2778
+ */
2779
+ getCurrentDirectory(): string;
2780
+ /**
2781
+ * The compiler's executing path.
2782
+ */
2783
+ getCompilerExecutingPath(): string;
2784
+ getEnvironmentVar?(key: string): string;
2785
+ /**
2786
+ * Gets the absolute file path when for a dependency module.
2787
+ */
2788
+ getLocalModulePath(opts: {
2789
+ rootDir: string;
2790
+ moduleId: string;
2791
+ path: string;
2792
+ }): string;
2793
+ /**
2794
+ * Gets the full url when requesting a dependency module to fetch from a CDN.
2795
+ */
2796
+ getRemoteModuleUrl(opts: {
2797
+ moduleId: string;
2798
+ path?: string;
2799
+ version?: string;
2800
+ }): string;
2801
+ /**
2802
+ * Async glob task. Only available in NodeJS compiler system.
2803
+ */
2804
+ glob?(pattern: string, options: {
2805
+ cwd?: string;
2806
+ nodir?: boolean;
2807
+ [key: string]: any;
2808
+ }): Promise<string[]>;
2809
+ /**
2810
+ * The number of logical processors available to run threads on the user's computer (cpus).
2811
+ */
2812
+ hardwareConcurrency: number;
2813
+ /**
2814
+ * Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
2815
+ */
2816
+ isSymbolicLink(p: string): Promise<boolean>;
2817
+ lazyRequire?: LazyRequire;
2818
+ nextTick(cb: () => void): void;
2819
+ /**
2820
+ * Normalize file system path.
2821
+ */
2822
+ normalizePath(p: string): string;
2823
+ onProcessInterrupt?(cb: () => void): void;
2824
+ parseYarnLockFile?: (content: string) => {
2825
+ type: 'success' | 'merge' | 'conflict';
2826
+ object: any;
2827
+ };
2828
+ platformPath: PlatformPath;
2829
+ /**
2830
+ * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
2831
+ */
2832
+ readDir(p: string): Promise<string[]>;
2833
+ /**
2834
+ * SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
2835
+ */
2836
+ readDirSync(p: string): string[];
2837
+ /**
2838
+ * Returns undefined if file is not found. Does not throw.
2839
+ */
2840
+ readFile(p: string): Promise<string>;
2841
+ readFile(p: string, encoding: 'utf8'): Promise<string>;
2842
+ readFile(p: string, encoding: 'binary'): Promise<any>;
2843
+ /**
2844
+ * SYNC! Returns undefined if file is not found. Does not throw.
2845
+ */
2846
+ readFileSync(p: string, encoding?: string): string;
2847
+ /**
2848
+ * Does not throw.
2849
+ */
2850
+ realpath(p: string): Promise<CompilerSystemRealpathResults>;
2851
+ /**
2852
+ * SYNC! Does not throw.
2853
+ */
2854
+ realpathSync(p: string): CompilerSystemRealpathResults;
2855
+ /**
2856
+ * Remove a callback which will be ran when destroy() is called.
2857
+ */
2858
+ removeDestroy(cb: () => void): void;
2859
+ /**
2860
+ * Rename old path to new path. Does not throw.
2861
+ */
2862
+ rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
2863
+ resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
2864
+ resolvePath(p: string): string;
2865
+ /**
2866
+ * Does not throw.
2867
+ */
2868
+ removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
2869
+ /**
2870
+ * SYNC! Does not throw.
2871
+ */
2872
+ removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
2873
+ /**
2874
+ * Does not throw.
2875
+ */
2876
+ removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
2877
+ /**
2878
+ * SYNC! Does not throw.
2879
+ */
2880
+ removeFileSync(p: string): CompilerSystemRemoveFileResults;
2881
+ setupCompiler?: (c: {
2882
+ ts: any;
2883
+ }) => void;
2884
+ /**
2885
+ * Always returns an object. Does not throw. Check for "error" property if there's an error.
2886
+ */
2887
+ stat(p: string): Promise<CompilerFsStats>;
2888
+ /**
2889
+ * SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
2890
+ */
2891
+ statSync(p: string): CompilerFsStats;
2892
+ tmpDirSync(): string;
2893
+ watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
2894
+ /**
2895
+ * A `watchFile` implementation in order to hook into the rest of the {@link CompilerSystem} implementation that is
2896
+ * used when running Stencil's compiler in "watch mode".
2897
+ *
2898
+ * It is analogous to TypeScript's `watchFile` implementation.
2899
+ *
2900
+ * Note, this function may be called for full builds of Stencil projects by the TypeScript compiler. It should not
2901
+ * assume that it will only be called in watch mode.
2902
+ *
2903
+ * This function should not perform any file watcher registration itself. Each `path` provided to it when called
2904
+ * should already have been registered as a file to watch.
2905
+ *
2906
+ * @param path the path to the file that is being watched
2907
+ * @param callback a callback to invoke when a file that is being watched has changed in some way
2908
+ * @returns an object with a method for unhooking the file watcher from the system
2909
+ */
2910
+ watchFile?(path: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
2911
+ /**
2912
+ * How many milliseconds to wait after a change before calling watch callbacks.
2913
+ */
2914
+ watchTimeout?: number;
2915
+ /**
2916
+ * Does not throw.
2917
+ */
2918
+ writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
2919
+ /**
2920
+ * SYNC! Does not throw.
2921
+ */
2922
+ writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
2923
+ }
2924
+ interface TranspileOnlyResults {
2925
+ diagnostics: Diagnostic[];
2926
+ output: string;
2927
+ sourceMap: any;
2928
+ }
2929
+ interface ParsedPath {
2930
+ root: string;
2931
+ dir: string;
2932
+ base: string;
2933
+ ext: string;
2934
+ name: string;
2935
+ }
2936
+ interface PlatformPath {
2937
+ normalize(p: string): string;
2938
+ join(...paths: string[]): string;
2939
+ resolve(...pathSegments: string[]): string;
2940
+ isAbsolute(p: string): boolean;
2941
+ relative(from: string, to: string): string;
2942
+ dirname(p: string): string;
2943
+ basename(p: string, ext?: string): string;
2944
+ extname(p: string): string;
2945
+ parse(p: string): ParsedPath;
2946
+ sep: string;
2947
+ delimiter: string;
2948
+ posix: any;
2949
+ win32: any;
2950
+ }
2951
+ interface CompilerDependency {
2952
+ name: string;
2953
+ version: string;
2954
+ main: string;
2955
+ resources?: string[];
2956
+ }
2957
+ interface ResolveModuleIdOptions {
2958
+ moduleId: string;
2959
+ containingFile?: string;
2960
+ exts?: string[];
2961
+ packageFilter?: (pkg: any, pkgFile: string) => any;
2962
+ }
2963
+ interface ResolveModuleIdResults {
2964
+ moduleId: string;
2965
+ resolveId: string;
2966
+ pkgData: {
2967
+ name: string;
2968
+ version: string;
2969
+ [key: string]: any;
2970
+ };
2971
+ pkgDirPath: string;
2972
+ }
2973
+ /**
2974
+ * A controller which provides for communication and coordination between
2975
+ * threaded workers.
2976
+ */
2977
+ interface WorkerMainController<T extends Record<string, (...args: any[]) => Promise<any>> = Record<string, (...args: any[]) => Promise<any>>> {
2978
+ /**
2979
+ * Send a given set of arguments to a worker
2980
+ */
2981
+ send<K extends keyof T>(methodName: K, ...args: Parameters<T[K]>): ReturnType<T[K]>;
2982
+ /**
2983
+ * Handle a particular method
2984
+ *
2985
+ * @param name of the method to be passed to a worker
2986
+ * @returns a Promise wrapping the results
2987
+ */
2988
+ handler<K extends keyof T>(name: K): T[K];
2989
+ /**
2990
+ * Destroy the worker represented by this instance, rejecting all outstanding
2991
+ * tasks and killing the child process.
2992
+ */
2993
+ destroy(): void;
2994
+ /**
2995
+ * The current setting for the max number of workers
2996
+ */
2997
+ maxWorkers: number;
2998
+ }
2999
+ interface CopyResults {
3000
+ diagnostics: Diagnostic[];
3001
+ filePaths: string[];
3002
+ dirPaths: string[];
3003
+ }
3004
+ interface SystemDetails {
3005
+ cpuModel: string;
3006
+ freemem(): number;
3007
+ platform: 'darwin' | 'windows' | 'linux' | '';
3008
+ release: string;
3009
+ totalmem: number;
3010
+ }
3011
+ interface BuildOnEvents {
3012
+ on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
3013
+ on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
3014
+ on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
3015
+ on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
3016
+ on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
3017
+ on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
3018
+ on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
3019
+ on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
3020
+ on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
3021
+ on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
3022
+ }
3023
+ interface BuildEmitEvents {
3024
+ emit(eventName: CompilerEventName, path: string): void;
3025
+ emit(eventName: CompilerEventFileAdd, path: string): void;
3026
+ emit(eventName: CompilerEventFileDelete, path: string): void;
3027
+ emit(eventName: CompilerEventFileUpdate, path: string): void;
3028
+ emit(eventName: CompilerEventDirAdd, path: string): void;
3029
+ emit(eventName: CompilerEventDirDelete, path: string): void;
3030
+ emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
3031
+ emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
3032
+ emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
3033
+ emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
3034
+ emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
3035
+ }
3036
+ interface FsWatchResults {
3037
+ dirsAdded: string[];
3038
+ dirsDeleted: string[];
3039
+ filesUpdated: string[];
3040
+ filesAdded: string[];
3041
+ filesDeleted: string[];
3042
+ }
3043
+ interface BuildLog {
3044
+ buildId: number;
3045
+ messages: string[];
3046
+ progress: number;
3047
+ }
3048
+ interface BuildNoChangeResults {
3049
+ buildId: number;
3050
+ noChange: boolean;
3051
+ }
3052
+ interface CompilerBuildResults {
3053
+ buildId: number;
3054
+ componentGraph?: BuildResultsComponentGraph;
3055
+ components: ComponentCompilerMeta[];
3056
+ diagnostics: Diagnostic[];
3057
+ dirsAdded: string[];
3058
+ dirsDeleted: string[];
3059
+ duration: number;
3060
+ filesAdded: string[];
3061
+ filesChanged: string[];
3062
+ filesDeleted: string[];
3063
+ filesUpdated: string[];
3064
+ hasError: boolean;
3065
+ hasSuccessfulBuild: boolean;
3066
+ hmr?: HotModuleReplacement;
3067
+ ssrAppFilePath?: string;
3068
+ isRebuild: boolean;
3069
+ namespace: string;
3070
+ fsNamespace: string;
3071
+ outputs: BuildOutput[];
3072
+ rootDir: string;
3073
+ srcDir: string;
3074
+ timestamp: string;
3075
+ }
3076
+ interface BuildResultsComponentGraph {
3077
+ [scopeId: string]: string[];
3078
+ }
3079
+ interface BuildOutput {
3080
+ type: string;
3081
+ files: string[];
3082
+ }
3083
+ interface HotModuleReplacement {
3084
+ componentsUpdated?: string[];
3085
+ excludeHmr?: string[];
3086
+ externalStylesUpdated?: string[];
3087
+ imagesUpdated?: string[];
3088
+ indexHtmlUpdated?: boolean;
3089
+ inlineStylesUpdated?: HmrStyleUpdate[];
3090
+ reloadStrategy: PageReloadStrategy;
3091
+ scriptsAdded?: string[];
3092
+ scriptsDeleted?: string[];
3093
+ serviceWorkerUpdated?: boolean;
3094
+ versionId?: string;
3095
+ }
3096
+ interface HmrStyleUpdate {
3097
+ styleId: string;
3098
+ styleTag: string;
3099
+ styleText: string;
3100
+ }
3101
+ type BuildOnEventRemove = () => boolean;
3102
+ interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
3103
+ unsubscribeAll(): void;
3104
+ }
3105
+ interface CompilerBuildStart {
3106
+ buildId: number;
3107
+ timestamp: string;
3108
+ }
3109
+ /**
3110
+ * A type describing a function to call when an event is emitted by a file watcher
3111
+ * @param fileName the path of the file tied to event
3112
+ * @param eventKind a variant describing the type of event that was emitter (added, edited, etc.)
3113
+ */
3114
+ type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
3115
+ /**
3116
+ * A type describing the different types of events that Stencil expects may happen when a file being watched is altered
3117
+ * in some way
3118
+ */
3119
+ type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
3120
+ type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
3121
+ type CompilerEventFsChange = 'fsChange';
3122
+ type CompilerEventFileUpdate = 'fileUpdate';
3123
+ type CompilerEventFileAdd = 'fileAdd';
3124
+ type CompilerEventFileDelete = 'fileDelete';
3125
+ type CompilerEventDirAdd = 'dirAdd';
3126
+ type CompilerEventDirDelete = 'dirDelete';
3127
+ type CompilerEventBuildStart = 'buildStart';
3128
+ type CompilerEventBuildFinish = 'buildFinish';
3129
+ type CompilerEventBuildLog = 'buildLog';
3130
+ type CompilerEventBuildNoChange = 'buildNoChange';
3131
+ interface CompilerFileWatcher {
3132
+ close(): void | Promise<void>;
3133
+ }
3134
+ interface CompilerFsStats {
3135
+ /**
3136
+ * If it's a directory. `false` if there was an error.
3137
+ */
3138
+ isDirectory: boolean;
3139
+ /**
3140
+ * If it's a file. `false` if there was an error.
3141
+ */
3142
+ isFile: boolean;
3143
+ /**
3144
+ * If it's a symlink. `false` if there was an error.
3145
+ */
3146
+ isSymbolicLink: boolean;
3147
+ /**
3148
+ * The size of the file in bytes. `0` for directories or if there was an error.
3149
+ */
3150
+ size: number;
3151
+ /**
3152
+ * The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
3153
+ */
3154
+ mtimeMs?: number;
3155
+ /**
3156
+ * Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
3157
+ */
3158
+ error: any;
3159
+ }
3160
+ interface CompilerSystemCreateDirectoryOptions {
3161
+ /**
3162
+ * Indicates whether parent directories should be created.
3163
+ * @default false
3164
+ */
3165
+ recursive?: boolean;
3166
+ /**
3167
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
3168
+ * @default 0o777.
3169
+ */
3170
+ mode?: number;
3171
+ }
3172
+ interface CompilerSystemCreateDirectoryResults {
3173
+ basename: string;
3174
+ dirname: string;
3175
+ path: string;
3176
+ newDirs: string[];
3177
+ error: any;
3178
+ }
3179
+ interface CompilerSystemRemoveDirectoryOptions {
3180
+ /**
3181
+ * Indicates whether child files and subdirectories should be removed.
3182
+ * @default false
3183
+ */
3184
+ recursive?: boolean;
3185
+ }
3186
+ interface CompilerSystemRemoveDirectoryResults {
3187
+ basename: string;
3188
+ dirname: string;
3189
+ path: string;
3190
+ removedDirs: string[];
3191
+ removedFiles: string[];
3192
+ error: any;
3193
+ }
3194
+ interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
3195
+ renamed: CompilerSystemRenamedPath[];
3196
+ oldDirs: string[];
3197
+ oldFiles: string[];
3198
+ newDirs: string[];
3199
+ newFiles: string[];
3200
+ error: any;
3201
+ }
3202
+ interface CompilerSystemRenamedPath {
3203
+ oldPath: string;
3204
+ newPath: string;
3205
+ isFile: boolean;
3206
+ isDirectory: boolean;
3207
+ }
3208
+ interface CompilerSystemRealpathResults {
3209
+ path: string;
3210
+ error: any;
3211
+ }
3212
+ interface CompilerSystemRemoveFileResults {
3213
+ basename: string;
3214
+ dirname: string;
3215
+ path: string;
3216
+ error: any;
3217
+ }
3218
+ interface CompilerSystemWriteFileResults {
3219
+ path: string;
3220
+ error: any;
3221
+ }
3222
+ interface Credentials {
3223
+ key: string;
3224
+ cert: string;
3225
+ }
3226
+ interface ConfigBundle {
3227
+ components: string[];
3228
+ }
3229
+ /**
3230
+ * A file and/or directory copy operation that may be specified as part of
3231
+ * certain output targets for Stencil (in particular `loader-bundle`,
3232
+ * `standalone`, and `www`).
3233
+ */
3234
+ interface CopyTask {
3235
+ /**
3236
+ * The source file path for a copy operation. This may be an absolute or
3237
+ * relative path to a directory or a file, and may also include a glob
3238
+ * pattern.
3239
+ *
3240
+ * If the path is a relative path it will be treated as relative to
3241
+ * `Config.srcDir`.
3242
+ */
3243
+ src: string;
3244
+ /**
3245
+ * An optional destination file path for a copy operation. This may be an
3246
+ * absolute or relative path.
3247
+ *
3248
+ * If relative, this will be treated as relative to the output directory for
3249
+ * the output target for which this copy operation is configured.
3250
+ */
3251
+ dest?: string;
3252
+ /**
3253
+ * Additional glob patterns to exclude from the copy operation, merged with
3254
+ * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
3255
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
3256
+ */
3257
+ ignore?: string[];
3258
+ /**
3259
+ * Whether or not Stencil should issue warnings if it cannot find the
3260
+ * specified source files or directories. Defaults to `false`.
3261
+ *
3262
+ * To receive warnings if a copy task source can't be found set this to
3263
+ * `true`.
3264
+ */
3265
+ warn?: boolean;
3266
+ /**
3267
+ * Whether or not directory structure should be preserved when copying files
3268
+ * from a source directory. Defaults to `true` if no `dest` path is supplied,
3269
+ * else it defaults to `false`.
3270
+ *
3271
+ * If this is set to `false`, all the files from a source directory will be
3272
+ * copied directly to the destination directory, but if it's set to `true` they
3273
+ * will be copied to a new directory inside the destination directory with
3274
+ * the same name as their original source directory.
3275
+ *
3276
+ * So if, for instance, `src` is set to `"images"` and `keepDirStructure` is
3277
+ * set to `true` the copy task will then produce the following directory
3278
+ * structure:
3279
+ *
3280
+ * ```
3281
+ * images
3282
+ * └── foo.png
3283
+ * dist
3284
+ * └── images
3285
+ * └── foo.png
3286
+ * ```
3287
+ *
3288
+ * Conversely if `keepDirStructure` is set to `false` then files in `images/`
3289
+ * will be copied to `dist` without first creating a new subdirectory,
3290
+ * resulting in the following directory structure:
3291
+ *
3292
+ * ```
3293
+ * images
3294
+ * └── foo.png
3295
+ * dist
3296
+ * └── foo.png
3297
+ * ```
3298
+ *
3299
+ * If a `dest` path is supplied then `keepDirStructure`
3300
+ * will default to `false`, so that Stencil will write the
3301
+ * copied files directly into the `dest` directory without creating a new
3302
+ * subdirectory. This behavior can be overridden by setting
3303
+ * `keepDirStructure` to `true`.
3304
+ */
3305
+ keepDirStructure?: boolean;
3306
+ }
3307
+ /**
3308
+ * Configuration for generating documentation from Stencil components.
3309
+ */
3310
+ interface StencilDocsConfig {
3311
+ /**
3312
+ * Options for processing and rendering Markdown documentation files.
3313
+ */
3314
+ markdown?: {
3315
+ /**
3316
+ * Styling for how the target component will be represented within documentation (e.g., in component diagrams).
3317
+ */
3318
+ targetComponent?: {
3319
+ /**
3320
+ * Background color used for nodes representing the component in diagrams (e.g., Mermaid graphs).
3321
+ * Use standard color names or hex codes.
3322
+ * @example '#f0f0f0' (light gray)
3323
+ */
3324
+ background?: string;
3325
+ /**
3326
+ * Text color used within nodes representing the component in diagrams (e.g., Mermaid graphs).
3327
+ * Use standard color names or hex codes.
3328
+ * @example '#333' (dark gray)
3329
+ */
3330
+ textColor?: string;
3331
+ };
3332
+ };
3333
+ }
3334
+ /** Options for rolldown's built-in module resolver, passed directly to rolldown's `resolve` input option. */
3335
+ type NodeResolveConfig = NonNullable<InputOptions['resolve']>;
3336
+ interface RolldownConfig {
3337
+ treeshake?: boolean;
3338
+ external?: (string | RegExp)[] | string | RegExp | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | undefined);
3339
+ }
3340
+ /**
3341
+ * This sets the log level hierarchy for our terminal logger, ranging from
3342
+ * most to least verbose.
3343
+ *
3344
+ * Ordering the levels like this lets us easily check whether we should log a
3345
+ * message at a given time. For instance, if the log level is set to `'warn'`,
3346
+ * then anything passed to the logger with level `'warn'` or `'error'` should
3347
+ * be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
3348
+ *
3349
+ * If we have a current log level `currentLevel` and a message with level
3350
+ * `msgLevel` is passed to the logger, we can determine whether or not we should
3351
+ * log it by checking if the log level on the message is further up or at the
3352
+ * same level in the hierarchy than `currentLevel`, like so:
3353
+ *
3354
+ * ```ts
3355
+ * LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
3356
+ * ```
3357
+ *
3358
+ * NOTE: for the reasons described above, do not change the order of the entries
3359
+ * in this array without good reason!
3360
+ */
3361
+ declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
3362
+ type LogLevel = (typeof LOG_LEVELS)[number];
3363
+ /**
3364
+ * Abstract interface representing a logger with the capability to accept log
3365
+ * messages at various levels (debug, info, warn, and error), set colors, log
3366
+ * time spans, print diagnostic messages, and more.
3367
+ *
3368
+ * A Node.js-specific implementation of this interface is used when Stencil is
3369
+ * building and compiling a project.
3370
+ */
3371
+ interface Logger {
3372
+ enableColors: (useColors: boolean) => void;
3373
+ setLevel: (level: LogLevel) => void;
3374
+ getLevel: () => LogLevel;
3375
+ debug: (...msg: any[]) => void;
3376
+ info: (...msg: any[]) => void;
3377
+ warn: (...msg: any[]) => void;
3378
+ error: (...msg: any[]) => void;
3379
+ createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
3380
+ printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
3381
+ red: (msg: string) => string;
3382
+ green: (msg: string) => string;
3383
+ yellow: (msg: string) => string;
3384
+ blue: (msg: string) => string;
3385
+ magenta: (msg: string) => string;
3386
+ cyan: (msg: string) => string;
3387
+ gray: (msg: string) => string;
3388
+ bold: (msg: string) => string;
3389
+ dim: (msg: string) => string;
3390
+ bgRed: (msg: string) => string;
3391
+ emoji: (e: string) => string;
3392
+ setLogFilePath?: (p: string) => void;
3393
+ writeLogs?: (append: boolean) => void;
3394
+ createLineUpdater?: () => Promise<LoggerLineUpdater>;
3395
+ }
3396
+ interface LoggerLineUpdater {
3397
+ update(text: string): Promise<void>;
3398
+ stop(): Promise<void>;
3399
+ }
3400
+ interface LoggerTimeSpan {
3401
+ duration(): number;
3402
+ finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
3403
+ }
3404
+ /**
3405
+ * Output target for generating lazy-loaded component bundles with a loader infrastructure.
3406
+ * This creates an optimized distribution for CDN usage and applications that benefit from
3407
+ * lazy-loading components on demand.
3408
+ *
3409
+ * Formerly known as 'dist' in v4.
3410
+ *
3411
+ * @example
3412
+ * ```typescript
3413
+ * {
3414
+ * type: 'loader-bundle',
3415
+ * dir: 'dist/loader-bundle'
3416
+ * }
3417
+ * ```
3418
+ */
3419
+ interface OutputTargetLoaderBundle extends OutputTargetBaseNext {
3420
+ type: 'loader-bundle';
3421
+ /**
3422
+ * Directory where lazy-loaded bundles will be written.
3423
+ * @default '' (root of output directory)
3424
+ */
3425
+ buildDir?: string;
3426
+ copy?: CopyTask[];
3427
+ empty?: boolean;
3428
+ /**
3429
+ * Whether to generate CommonJS (CJS) bundles.
3430
+ *
3431
+ * When `true`, generates CJS output in `cjs/` subdirectory.
3432
+ * When `false` (default in v5+), only ESM bundles are generated.
3433
+ *
3434
+ * @default false
3435
+ */
3436
+ cjs?: boolean;
3437
+ /**
3438
+ * Custom path for the loader directory; files you can import
3439
+ * in an initiation script within your application to register all your components for
3440
+ * lazy loading.
3441
+ *
3442
+ * @default 'loader' (relative to output directory)
3443
+ */
3444
+ loaderPath?: string;
3445
+ /**
3446
+ * Hash the filenames of generated chunks based on their content.
3447
+ * Enables forever-caching of CDN-served bundles.
3448
+ *
3449
+ * @default true in production, false in dev mode
3450
+ */
3451
+ hashFileNames?: boolean;
3452
+ /**
3453
+ * Number of characters to use for the content hash in filenames.
3454
+ *
3455
+ * @default 8
3456
+ */
3457
+ hashedFileNameLength?: number;
3458
+ /**
3459
+ * When `true`, marks `@stencil/core` as an external dependency in the bundler (ESM/CJS)
3460
+ * distribution output. Consumers must provide `@stencil/core` themselves.
3461
+ *
3462
+ * Has no effect on the browser/CDN build - the runtime is always bundled there.
3463
+ *
3464
+ * @default false
3465
+ */
3466
+ externalRuntime?: boolean;
3467
+ }
3468
+ /**
3469
+ * Output target for generating Stencil component source for downstream re-bundling.
3470
+ * This output contains transpiled source code, component metadata, and configuration
3471
+ * that downstream Stencil projects can re-compile and bundle.
3472
+ *
3473
+ * Formerly 'dist-collection' sub-output in v4, now a first-class output target in v5.
3474
+ *
3475
+ * In production builds, this output is auto-generated unless explicitly configured.
3476
+ *
3477
+ * @example
3478
+ * ```typescript
3479
+ * {
3480
+ * type: 'collection',
3481
+ * dir: 'dist/collection',
3482
+ * transformAliasedImportPaths: true
3483
+ * }
3484
+ * ```
3485
+ */
3486
+ interface OutputTargetCollection extends OutputTargetBaseNext {
3487
+ type: 'collection';
3488
+ empty?: boolean;
3489
+ /**
3490
+ * When `true` this flag will transform aliased import paths defined in
3491
+ * a project's `tsconfig.json` to relative import paths in the compiled output.
3492
+ *
3493
+ * Paths will be left in aliased format if `false` or `undefined`.
3494
+ *
3495
+ * @example
3496
+ * // tsconfig.json
3497
+ * {
3498
+ * paths: {
3499
+ * "@utils/*": ['/src/utils/*']
3500
+ * }
3501
+ * }
3502
+ *
3503
+ * // Source file
3504
+ * import * as dateUtils from '@utils/date-utils';
3505
+ * // Output file
3506
+ * import * as dateUtils from '../utils/date-utils';
3507
+ */
3508
+ transformAliasedImportPaths?: boolean | null;
3509
+ }
3510
+ /**
3511
+ * Output target for generating TypeScript type definitions (.d.ts files).
3512
+ *
3513
+ * Formerly a sub-output of 'dist' and 'dist-custom-elements' in v4,
3514
+ * now a first-class output target in v5 that can be shared across multiple outputs.
3515
+ *
3516
+ * In production builds, this output is auto-generated unless explicitly configured.
3517
+ *
3518
+ * @example
3519
+ * ```typescript
3520
+ * {
3521
+ * type: 'types',
3522
+ * dir: 'dist/types'
3523
+ * }
3524
+ * ```
3525
+ */
3526
+ interface OutputTargetTypes extends OutputTargetBaseNext {
3527
+ type: 'types';
3528
+ empty?: boolean;
3529
+ }
3530
+ interface OutputTargetDistLazy extends OutputTargetBase {
3531
+ type: 'dist-lazy';
3532
+ dir?: string;
3533
+ esmDir?: string;
3534
+ cjsDir?: string;
3535
+ isBrowserBuild?: boolean;
3536
+ esmIndexFile?: string;
3537
+ cjsIndexFile?: string;
3538
+ loaderDir?: string;
3539
+ typesDir?: string;
3540
+ empty?: boolean;
3541
+ /** Inherited from parent output target (loader-bundle or www). Only meaningful for browser builds. */
3542
+ hashFileNames?: boolean;
3543
+ /** Inherited from parent output target (loader-bundle or www). */
3544
+ hashedFileNameLength?: number;
3545
+ /** Inherited from loader-bundle. When true, @stencil/core is external in this bundler output. */
3546
+ externalRuntime?: boolean;
3547
+ }
3548
+ /**
3549
+ * Output target for global styles.
3550
+ * Generates a CSS file from an input stylesheet.
3551
+ *
3552
+ * Can be configured in two ways:
3553
+ * 1. **Implicit** (backwards compat): Set `globalStyle` in the config and this output is auto-generated
3554
+ * 2. **Explicit**: Define this output target with an `input` property
3555
+ *
3556
+ * Multiple `global-style` outputs are supported for building separate CSS bundles.
3557
+ *
3558
+ * @example
3559
+ * ```typescript
3560
+ * // Explicit configuration with custom input/output
3561
+ * {
3562
+ * type: 'global-style',
3563
+ * input: './src/theme.css',
3564
+ * fileName: 'theme.css',
3565
+ * dir: 'dist/assets',
3566
+ * copyToLoaderBrowser: false
3567
+ * }
3568
+ * ```
3569
+ */
3570
+ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
3571
+ type: 'global-style';
3572
+ /**
3573
+ * Path to the input CSS file to compile.
3574
+ * When specified, this takes precedence over the `globalStyle` config option.
3575
+ *
3576
+ * If neither `input` nor `globalStyle` config is set, no CSS will be built.
3577
+ */
3578
+ input?: string;
3579
+ /**
3580
+ * Output filename for the compiled CSS.
3581
+ * @default '{namespace}.css' when using globalStyle config, or basename of input file
3582
+ */
3583
+ fileName?: string;
3584
+ /**
3585
+ * When `true`, also copies the global style CSS to the loader-bundle browser directory
3586
+ * for backwards compatibility with existing CDN consumers who have hardcoded CSS paths.
3587
+ *
3588
+ * @default true
3589
+ */
3590
+ copyToLoaderBrowser?: boolean;
3591
+ /**
3592
+ * Controls whether this global stylesheet is injected into component shadow DOMs
3593
+ * as a constructable stylesheet at runtime.
3594
+ *
3595
+ * - `'none'` (default): Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
3596
+ * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
3597
+ * - `'all'`: Inject in both client and SSR builds
3598
+ *
3599
+ * @default 'none'
3600
+ */
3601
+ inject?: 'none' | 'client' | 'all';
3602
+ }
3603
+ /**
3604
+ * Output target for component assets.
3605
+ * Copies all component `assetsDirs` to a unified location.
3606
+ *
3607
+ * auto-generated when components have `assetsDirs` unless explicitly configured.
3608
+ * The output is placed in `dist/assets/` by default and is available to all distribution strategies.
3609
+ *
3610
+ * @example
3611
+ * ```typescript
3612
+ * {
3613
+ * type: 'assets',
3614
+ * dir: 'dist/assets'
3615
+ * }
3616
+ * ```
3617
+ */
3618
+ interface OutputTargetAssets extends OutputTargetBaseNext {
3619
+ type: 'assets';
3620
+ }
3621
+ /**
3622
+ * Output target for server-side rendering (SSR) and hydration.
3623
+ * Generates a script that can be used for SSR and static site generation (prerendering).
3624
+ *
3625
+ * Formerly known as 'dist-hydrate-script' in v4.
3626
+ *
3627
+ * @example
3628
+ * ```typescript
3629
+ * {
3630
+ * type: 'ssr',
3631
+ * dir: 'dist/ssr',
3632
+ * minify: true
3633
+ * }
3634
+ * ```
3635
+ */
3636
+ interface OutputTargetSsr extends OutputTargetBase {
3637
+ type: 'ssr';
3638
+ dir?: string;
3639
+ /**
3640
+ * Module IDs that should not be bundled into the script.
3641
+ * By default, all node builtin's, such as `fs` or `path`
3642
+ * will be considered "external" and not bundled.
3643
+ */
3644
+ external?: string[];
3645
+ empty?: boolean;
3646
+ minify?: boolean;
3647
+ /**
3648
+ * Whether to generate CommonJS (CJS) bundles.
3649
+ *
3650
+ * When `true`, generates CJS output as `index.cjs` alongside ESM `index.js`.
3651
+ * When `false` (default in v5+), only ESM bundles are generated.
3652
+ *
3653
+ * @default false
3654
+ */
3655
+ cjs?: boolean;
3656
+ }
3657
+ interface OutputTargetSsrWasm extends OutputTargetBase {
3658
+ type: 'ssr-wasm';
3659
+ /** Output directory. @default 'dist/ssr-wasm' */
3660
+ dir?: string;
3661
+ empty?: boolean;
3662
+ minify?: boolean;
3663
+ }
3664
+ interface OutputTargetCustom extends OutputTargetBase {
3665
+ type: 'custom';
3666
+ name: string;
3667
+ /**
3668
+ * Indicate when the output target should be executed.
3669
+ *
3670
+ * - `"onBuildOnly"`: Executed only when `stencil build` is called without `--watch`.
3671
+ * - `"always"`: Executed on every build, including in `watch` mode.
3672
+ *
3673
+ * Defaults to "always".
3674
+ */
3675
+ taskShouldRun?: 'onBuildOnly' | 'always';
3676
+ validate?: (config: Config, diagnostics: Diagnostic[]) => void;
3677
+ generator: (config: Config, compilerCtx: CompilerCtx, buildCtx: BuildCtx, docs: JsonDocs) => Promise<void>;
3678
+ copy?: CopyTask[];
3679
+ }
3680
+ /**
3681
+ * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
3682
+ * file.
3683
+ */
3684
+ interface OutputTargetDocsVscode extends OutputTargetBase {
3685
+ /**
3686
+ * Designates this output target to be used for generating VS Code custom data.
3687
+ * @see OutputTargetBase#type
3688
+ */
3689
+ type: 'docs-vscode';
3690
+ /**
3691
+ * The location on disk to write the JSON file.
3692
+ */
3693
+ file: string;
3694
+ /**
3695
+ * A base URL to find the source code of the component(s) described in the JSON file.
3696
+ */
3697
+ sourceCodeBaseUrl?: string;
3698
+ }
3699
+ interface OutputTargetDocsReadme extends OutputTargetBase {
3700
+ type: 'docs-readme';
3701
+ /**
3702
+ * The root directory where README files should be written
3703
+ *
3704
+ * defaults to {@link Config.srcDir}
3705
+ */
3706
+ dir?: string;
3707
+ dependencies?: boolean;
3708
+ /**
3709
+ * Controls how READMEs are written to the destination directory.
3710
+ *
3711
+ * - `true`: Always overwrite the destination README with the full content.
3712
+ * - `false` (default): Only update the autogenerated content, preserving existing custom content above it.
3713
+ * - `'if-missing'`: Write the full README only if no file exists at the destination.
3714
+ *
3715
+ * This option enables workflows requiring consistent, idempotent output across builds,
3716
+ * and supports setups where custom documentation may need to coexist or vary between environments.
3717
+ */
3718
+ overwriteExisting?: boolean | 'if-missing';
3719
+ footer?: string;
3720
+ strict?: boolean;
3721
+ }
3722
+ interface OutputTargetDocsJson extends OutputTargetBase {
3723
+ type: 'docs-json';
3724
+ file: string;
3725
+ /**
3726
+ * Set an optional file path where Stencil should write a `d.ts` file to disk
3727
+ * at build-time containing type declarations for {@link JsonDocs} and related
3728
+ * interfaces. If this is omitted or set to `null` Stencil will not write such
3729
+ * a file.
3730
+ */
3731
+ typesFile?: string | null;
3732
+ strict?: boolean;
3733
+ /**
3734
+ * An optional file path pointing to a public type library which should be
3735
+ * included and documented in the same way as other types which are included
3736
+ * in this output target.
3737
+ *
3738
+ * This could be useful if, for instance, there are some important interfaces
3739
+ * used in a few places in a Stencil project which don't form part of the
3740
+ * public API for any of the project's components. Such interfaces will not
3741
+ * be included in the `docs-json` output by default, but if they're declared
3742
+ * and exported from a 'supplemental' file designated with this property then
3743
+ * they'll be included in the output, facilitating their documentation.
3744
+ */
3745
+ supplementalPublicTypes?: string;
3746
+ }
3747
+ interface OutputTargetDocsCustomElementsManifest extends OutputTargetBase {
3748
+ type: 'docs-custom-elements-manifest';
3749
+ /**
3750
+ * The file path where the custom-elements.json manifest will be written.
3751
+ * Defaults to 'custom-elements.json' in the root directory.
3752
+ */
3753
+ file: string;
3754
+ strict?: boolean;
3755
+ }
3756
+ interface OutputTargetDocsCustom extends OutputTargetBase {
3757
+ type: 'docs-custom';
3758
+ generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
3759
+ strict?: boolean;
3760
+ }
3761
+ interface OutputTargetStats extends OutputTargetBase {
3762
+ type: 'stats';
3763
+ file?: string;
3764
+ }
3765
+ interface OutputTargetBaseNext extends OutputTargetBase {
3766
+ dir?: string;
3767
+ }
3768
+ /**
3769
+ * The collection of valid export behaviors.
3770
+ * Used to generate a type for typed configs as well as output target validation
3771
+ * for the `standalone` output target.
3772
+ *
3773
+ * Adding a value to this const array will automatically add it as a valid option on the
3774
+ * output target configuration for `customElementsExportBehavior`.
3775
+ *
3776
+ * - `default`: No additional export or definition behavior will happen.
3777
+ * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
3778
+ * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
3779
+ * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
3780
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory.
3781
+ * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
3782
+ */
3783
+ declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
3784
+ /**
3785
+ * This type is auto-generated based on the values in `CustomElementsExportBehaviorOptions` array.
3786
+ * This is used on the output target config for intellisense in typed configs.
3787
+ */
3788
+ type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
3789
+ /**
3790
+ * Output target for generating standalone component modules.
3791
+ * Each component is output as an individual ES module that can be directly imported.
3792
+ *
3793
+ * This output target is ideal for npm consumption and tree-shaking, as consumers
3794
+ * can import only the components they need.
3795
+ *
3796
+ * Formerly known as 'dist-custom-elements' in v4.
3797
+ *
3798
+ * @example
3799
+ * ```typescript
3800
+ * {
3801
+ * type: 'standalone',
3802
+ * dir: 'dist/standalone',
3803
+ * externalRuntime: true,
3804
+ * autoLoader: true
3805
+ * }
3806
+ * ```
3807
+ */
3808
+ interface OutputTargetStandalone extends OutputTargetBaseNext {
3809
+ type: 'standalone';
3810
+ empty?: boolean;
3811
+ /**
3812
+ * Triggers the following behaviors when enabled:
3813
+ * 1. All `@stencil/core/*` module references are treated as external during bundling.
3814
+ * 2. File names are not hashed.
3815
+ * 3. File minification will follow the behavior defined at the root of the Stencil config.
3816
+ *
3817
+ * @default false
3818
+ */
3819
+ externalRuntime?: boolean;
3820
+ copy?: CopyTask[];
3821
+ includeGlobalScripts?: boolean;
3822
+ minify?: boolean;
3823
+ /**
3824
+ * Define the export/definition behavior for the output target's generated output.
3825
+ * This controls if/how custom elements will be defined or where components will be exported from.
3826
+ * If omitted, no auto-definition behavior or re-exporting will happen.
3827
+ */
3828
+ customElementsExportBehavior?: CustomElementsExportBehavior;
3829
+ /**
3830
+ * Generate an auto-loader script that uses MutationObserver to lazily load
3831
+ * and define custom elements as they appear in the DOM.
3832
+ *
3833
+ * @default true
3834
+ *
3835
+ * When set to `true`, generates a `loader.js` file that auto-starts on import.
3836
+ * Can also be configured with an object for more control:
3837
+ * - `fileName`: Custom filename for the loader (default: 'loader.js')
3838
+ * - `autoStart`: Whether to auto-start the loader on import (default: true)
3839
+ *
3840
+ * @example
3841
+ * ```typescript
3842
+ * // Simple usage
3843
+ * autoLoader: true
3844
+ *
3845
+ * // With options
3846
+ * autoLoader: {
3847
+ * fileName: 'my-loader.js',
3848
+ * autoStart: false
3849
+ * }
3850
+ * ```
3851
+ */
3852
+ autoLoader?: boolean | {
3853
+ /**
3854
+ * Custom filename for the generated loader script.
3855
+ * @default 'loader.js'
3856
+ */
3857
+ fileName?: string;
3858
+ /**
3859
+ * Whether to automatically start the loader when the script is imported.
3860
+ * If false, you must call `start()` manually.
3861
+ * @default true
3862
+ */
3863
+ autoStart?: boolean;
3864
+ };
3865
+ }
3866
+ /**
3867
+ * The base type for output targets. All output targets should extend this base type.
3868
+ */
3869
+ interface OutputTargetBase {
3870
+ /**
3871
+ * A unique string to differentiate one output target from another
3872
+ */
3873
+ type: string;
3874
+ /**
3875
+ * When `true`, this output target will be skipped during development builds (`--dev`).
3876
+ * This improves dev build times by not generating production-only artifacts.
3877
+ *
3878
+ * Defaults vary by output target type:
3879
+ * - `loader-bundle`: `false` (always builds)
3880
+ * - `standalone`: `true` (skips in dev)
3881
+ * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
3882
+ * - `docs-*`: `true` (skips in dev)
3883
+ * - `custom`: `true` (skips in dev)
3884
+ * - `www`, `copy`, `stats`: `false` (always runs)
3885
+ */
3886
+ skipInDev?: boolean;
3887
+ }
3888
+ type OutputTargetBuild = OutputTargetCollection | OutputTargetDistLazy;
3889
+ interface OutputTargetCopy extends OutputTargetBase {
3890
+ type: 'copy';
3891
+ dir: string;
3892
+ copy?: CopyTask[];
3893
+ }
3894
+ interface OutputTargetWww extends OutputTargetBase {
3895
+ /**
3896
+ * Webapp output target.
3897
+ */
3898
+ type: 'www';
3899
+ /**
3900
+ * Choose how components are bundled for the www output.
3901
+ *
3902
+ * - `'loader'` (default): Uses the loader-bundle architecture with chunk
3903
+ * splitting and a loader infrastructure. Best for production apps with many
3904
+ * components where you want optimal loading performance.
3905
+ *
3906
+ * - `'standalone'`: Uses standalone component modules with an auto-loader that
3907
+ * uses MutationObserver to dynamically import components as they appear in
3908
+ * the DOM. Simpler architecture, easier debugging, one module per component.
3909
+ *
3910
+ * Default: `'loader'`
3911
+ */
3912
+ bundleMode?: 'loader' | 'standalone';
3913
+ /**
3914
+ * The directory to write the app's JavaScript and CSS build
3915
+ * files to. The default is to place this directory as a child
3916
+ * to the `dir` config. Default: `build`
3917
+ */
3918
+ buildDir?: string;
3919
+ /**
3920
+ * The directory to write the entire application to.
3921
+ * Note, the `buildDir` is where the app's JavaScript and CSS build
3922
+ * files are written. Default: `www`
3923
+ */
3924
+ dir?: string;
3925
+ /**
3926
+ * Empty the build directory of all files and directories on first build.
3927
+ * Default: `true`
3928
+ */
3929
+ empty?: boolean;
3930
+ /**
3931
+ * The default index html file of the app, commonly found at the
3932
+ * root of the `src` directory.
3933
+ * Default: `index.html`
3934
+ */
3935
+ indexHtml?: string;
3936
+ /**
3937
+ * The copy config is an array of objects that defines any files or folders that should
3938
+ * be copied over to the build directory.
3939
+ *
3940
+ * Each object in the array must include a src property which can be either an absolute path,
3941
+ * a relative path or a glob pattern. The config can also provide an optional dest property
3942
+ * which can be either an absolute path or a path relative to the build directory.
3943
+ * Also note that any files within src/assets are automatically copied to www/assets for convenience.
3944
+ *
3945
+ * In the copy config below, it will copy the entire directory from src/docs-content over to www/docs-content.
3946
+ */
3947
+ copy?: CopyTask[];
3948
+ /**
3949
+ * The base url of the app, it's required during prerendering to be the absolute path
3950
+ * of your app, such as: `https://my.app.com/app`.
3951
+ *
3952
+ * Default: `/`
3953
+ */
3954
+ baseUrl?: string;
3955
+ /**
3956
+ * Path to an external node module which has exports of the prerender config object.
3957
+ * ```
3958
+ * module.exports = {
3959
+ * afterSsr(document, url) {
3960
+ * document.title = `URL: ${url.href}`;
3961
+ * }
3962
+ * }
3963
+ * ```
3964
+ */
3965
+ prerenderConfig?: string;
3966
+ /**
3967
+ * Service worker config for production builds. In development mode, a script
3968
+ * to deregister existing service workers is always injected. Defaults to
3969
+ * `null` (disabled). Set to `true` to enable with default settings, or provide
3970
+ * a config object for custom settings.
3971
+ */
3972
+ serviceWorker?: ServiceWorkerConfig | true | null;
3973
+ appDir?: string;
3974
+ /**
3975
+ * Hash the filenames of generated chunks based on their content.
3976
+ * Enables forever-caching of CDN-served bundles.
3977
+ *
3978
+ * @default true in production, false in dev mode
3979
+ */
3980
+ hashFileNames?: boolean;
3981
+ /**
3982
+ * Number of characters to use for the content hash in filenames.
3983
+ *
3984
+ * @default 8
3985
+ */
3986
+ hashedFileNameLength?: number;
3987
+ }
3988
+ type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetSsrWasm | OutputTargetCollection | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetStats;
3989
+ /**
3990
+ * A post-validation form of {@link OutputTargetWww} where `serviceWorker`
3991
+ * has been normalized - `true` is resolved to a {@link ServiceWorkerConfig}.
3992
+ */
3993
+ type ValidatedOutputTargetWww = Omit<OutputTargetWww, 'serviceWorker'> & {
3994
+ serviceWorker?: ServiceWorkerConfig | null;
3995
+ };
3996
+ /**
3997
+ * Our custom configuration interface for generated caching Service Workers
3998
+ * using the Workbox library (see https://developer.chrome.com/docs/workbox/).
3999
+ *
4000
+ * Although we are using Workbox we are unfortunately unable to depend on the
4001
+ * published types for the library because they must be compiled using the
4002
+ * `webworker` lib for TypeScript, which cannot be used at the same time as
4003
+ * the `dom` lib. So as a workaround we maintain our own interface here. See
4004
+ * here to refer to the published version:
4005
+ * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c7b4dadae5b320ad1311a8f82242b8f2f41b7b8c/types/workbox-build/generate-sw.d.ts#L3
4006
+ */
4007
+ interface ServiceWorkerConfig {
4008
+ unregister?: boolean;
4009
+ swDest?: string;
4010
+ swSrc?: string;
4011
+ globPatterns?: string[];
4012
+ globDirectory?: string | string[];
4013
+ globIgnores?: string | string[];
4014
+ templatedUrls?: any;
4015
+ maximumFileSizeToCacheInBytes?: number;
4016
+ manifestTransforms?: any;
4017
+ modifyUrlPrefix?: any;
4018
+ dontCacheBustURLsMatching?: RegExp;
4019
+ navigateFallback?: string;
4020
+ navigateFallbackWhitelist?: RegExp[];
4021
+ navigateFallbackBlacklist?: RegExp[];
4022
+ cacheId?: string;
4023
+ skipWaiting?: boolean;
4024
+ clientsClaim?: boolean;
4025
+ directoryIndex?: string;
4026
+ runtimeCaching?: any[];
4027
+ ignoreUrlParametersMatching?: any[];
4028
+ handleFetch?: boolean;
4029
+ }
4030
+ interface LoadConfigInit {
4031
+ /**
4032
+ * User config object to merge into default config and
4033
+ * config loaded from a file path.
4034
+ */
4035
+ config?: UnvalidatedConfig;
4036
+ /**
4037
+ * Absolute path to a Stencil config file. This path cannot be
4038
+ * relative and it does not resolve config files within a directory.
4039
+ */
4040
+ configPath?: string;
4041
+ logger?: Logger;
4042
+ sys?: CompilerSystem;
4043
+ }
4044
+ /**
4045
+ * Results from an attempt to load a config. The values on this interface
4046
+ * have not yet been validated and are not ready to be used for arbitrary
4047
+ * operations around the codebase.
4048
+ */
4049
+ interface LoadConfigResults {
4050
+ config: ValidatedConfig;
4051
+ diagnostics: Diagnostic[];
4052
+ tsconfig: {
4053
+ path: string;
4054
+ compilerOptions: any;
4055
+ files: string[];
4056
+ include: string[];
4057
+ exclude: string[];
4058
+ extends: string;
4059
+ };
4060
+ }
4061
+ interface Diagnostic {
4062
+ absFilePath?: string | undefined;
4063
+ code?: string;
4064
+ columnNumber?: number | undefined;
4065
+ debugText?: string;
4066
+ header?: string;
4067
+ language?: string;
4068
+ level: 'error' | 'warn' | 'info' | 'log' | 'debug';
4069
+ lineNumber?: number | undefined;
4070
+ lines: PrintLine[];
4071
+ messageText: string;
4072
+ relFilePath?: string | undefined;
4073
+ type: string;
4074
+ }
4075
+ interface CacheStorage {
4076
+ get(key: string): Promise<any>;
4077
+ set(key: string, value: any): Promise<void>;
4078
+ }
4079
+ interface WorkerOptions {
4080
+ maxConcurrentWorkers?: number;
4081
+ maxConcurrentTasksPerWorker?: number;
4082
+ logger?: Logger;
4083
+ }
4084
+ interface ResolveModuleOptions {
4085
+ manuallyResolve?: boolean;
4086
+ packageJson?: boolean;
4087
+ }
4088
+ interface PrerenderStartOptions {
4089
+ buildId?: string;
4090
+ ssrAppFilePath?: string;
4091
+ componentGraph?: BuildResultsComponentGraph;
4092
+ srcIndexHtmlPath?: string;
4093
+ }
4094
+ interface PrerenderResults {
4095
+ buildId: string;
4096
+ diagnostics: Diagnostic[];
4097
+ urls: number;
4098
+ duration: number;
4099
+ average: number;
4100
+ }
4101
+ /**
4102
+ * Input for CSS optimization functions, including the input CSS
4103
+ * string and a few boolean options which turn on or off various
4104
+ * optimizations.
4105
+ */
4106
+ interface OptimizeCssInput {
4107
+ input: string;
4108
+ filePath?: string;
4109
+ autoprefixer?: boolean | null | AutoprefixerOptions;
4110
+ minify?: boolean;
4111
+ sourceMap?: boolean;
4112
+ resolveUrl?: (url: string) => Promise<string> | string;
4113
+ }
4114
+ /**
4115
+ * Options for autoprefixing CSS via Lightning CSS.
4116
+ *
4117
+ * The `targets` field accepts a browserslist query array. When omitted,
4118
+ * Stencil uses a modern default browser list suitable for Stencil v5+.
4119
+ *
4120
+ * @example
4121
+ * ```ts
4122
+ * autoprefixer: {
4123
+ * targets: ['last 2 Chrome versions', 'last 2 Safari versions', 'iOS >= 14'],
4124
+ * }
4125
+ * ```
4126
+ */
4127
+ interface AutoprefixerOptions {
4128
+ /**
4129
+ * A browserslist query array describing which browsers to generate vendor
4130
+ * prefixes for. Defaults to a modern set of browsers appropriate for
4131
+ * Stencil v5+.
4132
+ */
4133
+ targets?: string[];
4134
+ }
4135
+ /**
4136
+ * Output from CSS optimization functions, wrapping up optimized
4137
+ * CSS and any diagnostics produced during optimization.
4138
+ */
4139
+ interface OptimizeCssOutput {
4140
+ output: string;
4141
+ diagnostics: Diagnostic[];
4142
+ }
4143
+ interface OptimizeJsInput {
4144
+ input: string;
4145
+ filePath?: string;
4146
+ target?: 'latest';
4147
+ pretty?: boolean;
4148
+ sourceMap?: boolean;
4149
+ }
4150
+ interface OptimizeJsOutput {
4151
+ output: string;
4152
+ sourceMap: any;
4153
+ diagnostics: Diagnostic[];
4154
+ }
4155
+ interface LazyRequire {
4156
+ ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
4157
+ require(fromDir: string, moduleId: string): any;
4158
+ getModulePath(fromDir: string, moduleId: string): string;
4159
+ }
4160
+ interface Compiler {
4161
+ build(): Promise<CompilerBuildResults>;
4162
+ createWatcher(): Promise<CompilerWatcher>;
4163
+ destroy(): Promise<void>;
4164
+ sys: CompilerSystem;
4165
+ /**
4166
+ * @internal - Testing only. Access to the in-memory filesystem
4167
+ */
4168
+ fs?: InMemoryFileSystem;
4169
+ /**
4170
+ * @internal - Testing only. Access to the validated configuration
4171
+ */
4172
+ config?: ValidatedConfig;
4173
+ /**
4174
+ * @internal - Testing only. Access to the compiler context
4175
+ */
4176
+ compilerCtx?: CompilerCtx;
4177
+ }
4178
+ interface CompilerWatcher extends BuildOnEvents {
4179
+ start: () => Promise<WatcherCloseResults>;
4180
+ close: () => Promise<WatcherCloseResults>;
4181
+ request: (data: CompilerRequest) => Promise<CompilerRequestResponse>;
4182
+ }
4183
+ interface CompilerRequest {
4184
+ path?: string;
4185
+ }
4186
+ interface WatcherCloseResults {
4187
+ exitCode: number;
4188
+ }
4189
+ interface CompilerRequestResponse {
4190
+ path: string;
4191
+ nodeModuleId: string;
4192
+ nodeModuleVersion: string;
4193
+ nodeResolvedPath: string;
4194
+ cachePath: string;
4195
+ cacheHit: boolean;
4196
+ content: string;
4197
+ status: number;
4198
+ }
4199
+ /**
4200
+ * Options for Stencil's string-to-string transpiler
4201
+ */
4202
+ interface TranspileOptions {
4203
+ /**
4204
+ * A component can be defined as a custom element by using `customelement`, or the
4205
+ * component class can be exported by using `module`. Default is `customelement`.
4206
+ */
4207
+ componentExport?: 'customelement' | 'module' | string | undefined;
4208
+ /**
4209
+ * Sets how and if component metadata should be assigned on the compiled
4210
+ * component output. The `compilerstatic` value will set the metadata to
4211
+ * a static `COMPILER_META` getter on the component class. This option
4212
+ * is useful for unit testing preprocessors. Default is `null`.
4213
+ */
4214
+ componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
4215
+ /**
4216
+ * The actual internal import path for any `@stencil/core` imports.
4217
+ * Default is `@stencil/core/runtime/client/standalone`.
4218
+ */
4219
+ coreImportPath?: string;
4220
+ /**
4221
+ * The current working directory. Default is `/`.
4222
+ */
4223
+ currentDirectory?: string;
4224
+ /**
4225
+ * The filename of the code being compiled. Default is `module.tsx`.
4226
+ */
4227
+ file?: string;
4228
+ /**
4229
+ * Module format to use for the compiled code output, which can be either `esm` or `cjs`.
4230
+ * Default is `esm`.
4231
+ */
4232
+ module?: 'cjs' | 'esm' | string;
4233
+ /**
4234
+ * Sets how and if any properties, methods and events are proxied on the
4235
+ * component class. The `defineproperty` value sets the getters and setters
4236
+ * using Object.defineProperty. Default is `defineproperty`.
4237
+ */
4238
+ proxy?: 'defineproperty' | string | undefined;
4239
+ /**
4240
+ * How component styles should be associated to the component. The `static`
4241
+ * setting will assign the styles as a static getter on the component class.
4242
+ */
4243
+ style?: 'static' | string | undefined;
4244
+ /**
4245
+ * How style data should be added for imports. For example, the `queryparams` value
4246
+ * adds the component's tagname and encapsulation info as querystring parameter
4247
+ * to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
4248
+ * style data can be used by bundlers to further optimize each component's css.
4249
+ * Set to `null` to not include the querystring parameters. Default is `queryparams`.
4250
+ */
4251
+ styleImportData?: 'queryparams' | string | undefined;
4252
+ /**
4253
+ * The JavaScript source target TypeScript should transpile to. Values can be
4254
+ * `latest`, `esnext`, `es2020`, `es2017`, or `es2015`. Defaults to `latest`.
4255
+ */
4256
+ target?: CompileTarget;
4257
+ /**
4258
+ * Create a source map. Using `inline` will inline the source map into the
4259
+ * code, otherwise the source map will be in the returned `map` property.
4260
+ * Default is `true`.
4261
+ */
4262
+ sourceMap?: boolean | 'inline';
4263
+ /**
4264
+ * Base directory to resolve non-relative module names. Same as the `baseUrl`
4265
+ * TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
4266
+ */
4267
+ baseUrl?: string;
4268
+ /**
4269
+ * List of path mapping entries for module names to locations relative to the `baseUrl`.
4270
+ * Same as the `paths` TypeScript compiler option:
4271
+ * https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
4272
+ */
4273
+ paths?: {
4274
+ [key: string]: string[];
4275
+ };
4276
+ /**
4277
+ * JSX mode for TypeScript compilation. Can be 'react', 'react-jsx', 'react-jsxdev', etc.
4278
+ * Same as the `jsx` TypeScript compiler option.
4279
+ */
4280
+ jsx?: number;
4281
+ /**
4282
+ * Module specifier for JSX factory. Used with automatic JSX runtime.
4283
+ * Same as the `jsxImportSource` TypeScript compiler option.
4284
+ */
4285
+ jsxImportSource?: string;
4286
+ /**
4287
+ * Passed in Stencil Compiler System, otherwise falls back to the internal in-memory only system.
4288
+ */
4289
+ sys?: CompilerSystem;
4290
+ /**
4291
+ * This option enables the same behavior as {@link Config.transformAliasedImportPaths}, transforming paths aliased in
4292
+ * `tsconfig.json` to relative paths.
4293
+ */
4294
+ transformAliasedImportPaths?: boolean;
4295
+ /**
4296
+ * List of tags to transform, by default only the incoming component tag is transformed
4297
+ */
4298
+ tagsToTransform?: string[];
4299
+ /**
4300
+ * Adds `transformTag` calls to css strings and querySelector(All) calls
4301
+ */
4302
+ additionalTagTransformers?: boolean;
4303
+ /**
4304
+ * A map of virtual file paths to source text for modules that the component
4305
+ * under transpilation extends from. When provided, `transpile()` builds a
4306
+ * minimal multi-file TypeScript program from these sources so that
4307
+ * {@link https://stenciljs.com/docs/component-lifecycle inheritance chains}
4308
+ * can be resolved without requiring the parent files to exist on disk.
4309
+ *
4310
+ * Keys are the same import paths used in the component's `import` statements
4311
+ * (relative paths are resolved against `currentDirectory`). Values are the
4312
+ * TypeScript/JavaScript source text of that module.
4313
+ *
4314
+ * @example
4315
+ * ```ts
4316
+ * transpile(myComponentCode, {
4317
+ * extraFiles: {
4318
+ * './base-component.ts': baseComponentSourceText,
4319
+ * },
4320
+ * });
4321
+ * ```
4322
+ */
4323
+ extraFiles?: Record<string, string>;
4324
+ }
4325
+ type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | string | undefined;
4326
+ interface TranspileResults {
4327
+ code: string;
4328
+ data?: any[];
4329
+ diagnostics: Diagnostic[];
4330
+ imports?: {
4331
+ path: string;
4332
+ }[];
4333
+ inputFileExtension: string;
4334
+ inputFilePath: string;
4335
+ map: any;
4336
+ outputFilePath: string;
4337
+ }
4338
+ interface TransformOptions {
4339
+ coreImportPath: string;
4340
+ componentExport: 'lazy' | 'module' | 'customelement' | null;
4341
+ componentMetadata: 'runtimestatic' | 'compilerstatic' | null;
4342
+ currentDirectory: string;
4343
+ file?: string;
4344
+ isolatedModules?: boolean;
4345
+ module?: 'cjs' | 'esm';
4346
+ proxy: 'defineproperty' | null;
4347
+ style: 'static' | null;
4348
+ styleImportData: 'queryparams' | null;
4349
+ target?: string;
4350
+ /**
4351
+ * @see {@link TranspileOptions.extraFiles}
4352
+ */
4353
+ extraFiles?: Record<string, string>;
4354
+ }
4355
+ interface CompileScriptMinifyOptions {
4356
+ target?: CompileTarget;
4357
+ pretty?: boolean;
4358
+ }
4359
+ interface DevServer extends BuildEmitEvents {
4360
+ address: string;
4361
+ basePath: string;
4362
+ browserUrl: string;
4363
+ protocol: string;
4364
+ port: number;
4365
+ root: string;
4366
+ close(): Promise<void>;
4367
+ }
4368
+ interface CliInitOptions {
4369
+ args: string[];
4370
+ logger: Logger;
4371
+ sys: CompilerSystem;
4372
+ }
4373
+ //#endregion
4374
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, ValidatedOutputTargetWww, WatcherCloseResults, WorkerMainController, WorkerOptions };