1 | import type { ConfigFlags } from '../cli/config-flags';
|
2 | import type { PrerenderUrlResults, PrintLine } from '../internal';
|
3 | import type { BuildCtx, CompilerCtx } from './stencil-private';
|
4 | import type { JsonDocs } from './stencil-public-docs';
|
5 | import type { ResolutionHandler } from './stencil-public-runtime';
|
6 | export * from './stencil-public-docs';
|
7 | /**
|
8 | * https://stenciljs.com/docs/config/
|
9 | */
|
10 | export interface StencilConfig {
|
11 | /**
|
12 | * By default, Stencil will attempt to optimize small scripts by inlining them in HTML. Setting
|
13 | * this flag to `false` will prevent this optimization and keep all scripts separate from HTML.
|
14 | */
|
15 | allowInlineScripts?: boolean;
|
16 | /**
|
17 | * By setting `autoprefixCss` to `true`, Stencil will use the appropriate config to automatically
|
18 | * prefix css. For example, developers can write modern and standard css properties, such as
|
19 | * "transform", and Stencil will automatically add in the prefixed version, such as "-webkit-transform".
|
20 | * As of Stencil v2, autoprefixing CSS is no longer the default.
|
21 | * Defaults to `false`
|
22 | */
|
23 | autoprefixCss?: boolean | any;
|
24 | /**
|
25 | * By default, Stencil will statically analyze the application and generate a component graph of
|
26 | * how all the components are interconnected.
|
27 | *
|
28 | * From the component graph it is able to best decide how components should be grouped
|
29 | * depending on their usage with one another within the app.
|
30 | * By doing so it's able to bundle components together in order to reduce network requests.
|
31 | * However, bundles can be manually generated using the bundles config.
|
32 | *
|
33 | * The bundles config is an array of objects that represent how components are grouped together
|
34 | * in lazy-loaded bundles.
|
35 | * This config is rarely needed as Stencil handles this automatically behind the scenes.
|
36 | */
|
37 | bundles?: ConfigBundle[];
|
38 | /**
|
39 | * Stencil will cache build results in order to speed up rebuilds.
|
40 | * To disable this feature, set enableCache to false.
|
41 | */
|
42 | enableCache?: boolean;
|
43 | /**
|
44 | * The directory where sub-directories will be created for caching when `enableCache` is set
|
45 | * `true` or if using Stencil's Screenshot Connector.
|
46 | *
|
47 | * @default '.stencil'
|
48 | *
|
49 | * @example
|
50 | *
|
51 | * A Stencil config like the following:
|
52 | * ```ts
|
53 | * export const config = {
|
54 | * ...,
|
55 | * enableCache: true,
|
56 | * cacheDir: '.cache',
|
57 | * testing: {
|
58 | * screenshotConnector: 'connector.js'
|
59 | * }
|
60 | * }
|
61 | * ```
|
62 | *
|
63 | * Will result in the following file structure:
|
64 | * ```tree
|
65 | * stencil-project-root
|
66 | * └── .cache
|
67 | * ├── .build <-- Where build related file caching is written
|
68 | * |
|
69 | * └── screenshot-cache.json <-- Where screenshot caching is written
|
70 | * ```
|
71 | */
|
72 | cacheDir?: string;
|
73 | /**
|
74 | * Stencil is traditionally used to compile many components into an app,
|
75 | * and each component comes with its own compartmentalized styles.
|
76 | * However, it's still common to have styles which should be "global" across all components and the website.
|
77 | * A global CSS file is often useful to set CSS Variables.
|
78 | *
|
79 | * Additionally, the globalStyle config can be used to precompile styles with Sass, PostCSS, etc.
|
80 | * Below is an example folder structure containing a webapp's global sass file, named app.css.
|
81 | */
|
82 | globalStyle?: string;
|
83 | /**
|
84 | * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
|
85 | * for each component in the build when `true`.
|
86 | *
|
87 | * @default false
|
88 | */
|
89 | generateExportMaps?: boolean;
|
90 | /**
|
91 | * When the hashFileNames config is set to true, and it is a production build,
|
92 | * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
|
93 | */
|
94 | hashedFileNameLength?: number;
|
95 | /**
|
96 | * During production builds, the content of each generated file is hashed to represent the content,
|
97 | * and the hashed value is used as the filename. If the content isn't updated between builds,
|
98 | * then it receives the same filename. When the content is updated, then the filename is different.
|
99 | *
|
100 | * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
|
101 | * content delivery networks (CDNs) and heavily caching files for faster apps.
|
102 | */
|
103 | hashFileNames?: boolean;
|
104 | /**
|
105 | * The namespace config is a string representing a namespace for the app.
|
106 | * For apps that are not meant to be a library of reusable components,
|
107 | * the default of App is just fine. However, if the app is meant to be consumed
|
108 | * as a third-party library, such as Ionic, a unique namespace is required.
|
109 | */
|
110 | namespace?: string;
|
111 | /**
|
112 | * Stencil is able to take an app's source and compile it to numerous targets,
|
113 | * such as an app to be deployed on an http server, or as a third-party library
|
114 | * to be distributed on npm. By default, Stencil apps have an output target type of www.
|
115 | *
|
116 | * The outputTargets config is an array of objects, with types of www and dist.
|
117 | */
|
118 | outputTargets?: OutputTarget[];
|
119 | /**
|
120 | * The plugins config can be used to add your own rollup plugins.
|
121 | * By default, Stencil does not come with Sass or PostCSS support.
|
122 | * However, either can be added using the plugin array.
|
123 | */
|
124 | plugins?: any[];
|
125 | /**
|
126 | * Generate js source map files for all bundles
|
127 | */
|
128 | sourceMap?: boolean;
|
129 | /**
|
130 | * The srcDir config specifies the directory which should contain the source typescript files
|
131 | * for each component. The standard for Stencil apps is to use src, which is the default.
|
132 | */
|
133 | srcDir?: string;
|
134 | /**
|
135 | * Sets whether or not Stencil should transform path aliases set in a project's
|
136 | * `tsconfig.json` from the assigned module aliases to resolved relative paths.
|
137 | *
|
138 | * This behavior defaults to `true`, but may be opted-out of by setting this flag to `false`.
|
139 | */
|
140 | transformAliasedImportPaths?: boolean;
|
141 | /**
|
142 | * When `true`, we will validate a project's `package.json` based on the output target the user has designated
|
143 | * as `isPrimaryPackageOutputTarget: true` in their Stencil config.
|
144 | */
|
145 | validatePrimaryPackageOutputTarget?: boolean;
|
146 | /**
|
147 | * Passes custom configuration down to the "@rollup/plugin-commonjs" that Stencil uses under the hood.
|
148 | * For further information: https://stenciljs.com/docs/module-bundling
|
149 | */
|
150 | commonjs?: BundlingConfig;
|
151 | /**
|
152 | * Passes custom configuration down to the "@rollup/plugin-node-resolve" that Stencil uses under the hood.
|
153 | * For further information: https://stenciljs.com/docs/module-bundling
|
154 | */
|
155 | nodeResolve?: NodeResolveConfig;
|
156 | /**
|
157 | * Passes custom configuration down to rollup itself, not all rollup options can be overridden.
|
158 | */
|
159 | rollupConfig?: RollupConfig;
|
160 | /**
|
161 | * Sets if the ES5 build should be generated or not. Stencil generates a modern build without ES5,
|
162 | * whereas this setting to `true` will also create es5 builds for both dev and prod modes. Setting
|
163 | * `buildEs5` to `prod` will only build ES5 in prod mode. Basically if the app does not need to run
|
164 | * on legacy browsers (IE11 and Edge 18 and below), it's safe to not build ES5, which will also speed
|
165 | * up build times. Defaults to `false`.
|
166 | */
|
167 | buildEs5?: boolean | 'prod';
|
168 | /**
|
169 | * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
|
170 | * Defaults to `false` in dev mode and `true` in production mode.
|
171 | */
|
172 | minifyJs?: boolean;
|
173 | /**
|
174 | * Sets if the CSS is minified or not.
|
175 | * Defaults to `false` in dev mode and `true` in production mode.
|
176 | */
|
177 | minifyCss?: boolean;
|
178 | /**
|
179 | * Forces Stencil to run in `dev` mode if the value is `true` and `production` mode
|
180 | * if it's `false`.
|
181 | *
|
182 | * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
|
183 | */
|
184 | devMode?: boolean;
|
185 | /**
|
186 | * Object to provide a custom logger. By default a `logger` is already provided for the
|
187 | * platform the compiler is running on, such as NodeJS or a browser.
|
188 | */
|
189 | logger?: Logger;
|
190 | /**
|
191 | * Config to add extra runtime for DOM features that require more polyfills. Note
|
192 | * that not all DOM APIs are fully polyfilled when using the slot polyfill. These
|
193 | * are opt-in since not all users will require the additional runtime.
|
194 | */
|
195 | extras?: ConfigExtras;
|
196 | /**
|
197 | * The hydrated flag identifies if a component and all of its child components
|
198 | * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
|
199 | * as various components are asynchronously downloaded and rendered. By default it
|
200 | * will add the `hydrated` CSS class to the element. The `hydratedFlag` config can be used
|
201 | * to change the name of the CSS class, change it to an attribute, or change which
|
202 | * type of CSS properties and values are assigned before and after hydrating. This config
|
203 | * can also be used to not include the hydrated flag at all by setting it to `null`.
|
204 | */
|
205 | hydratedFlag?: HydratedFlag | null;
|
206 | /**
|
207 | * Ionic prefers to hide all components prior to hydration with a style tag appended
|
208 | * to the head of the document containing some `visibility: hidden;` css rules.
|
209 | *
|
210 | * Disabling this will remove the style tag that sets `visibility: hidden;` on all
|
211 | * un-hydrated web components. This more closely follows the HTML spec, and allows
|
212 | * you to set your own fallback content.
|
213 | *
|
214 | */
|
215 | invisiblePrehydration?: boolean;
|
216 | /**
|
217 | * Sets the task queue used by stencil's runtime. The task queue schedules DOM read and writes
|
218 | * across the frames to efficiently render and reduce layout thrashing. By default,
|
219 | * `async` is used. It's recommended to also try each setting to decide which works
|
220 | * best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
|
221 | * main thread to periodically lock-up, it's always recommended to try
|
222 | * [Web Workers](https://stenciljs.com/docs/web-workers) for those tasks.
|
223 | *
|
224 | * - `async`: DOM read and writes are scheduled in the next frame to prevent layout thrashing.
|
225 | * During intensive CPU tasks it will not reschedule rendering to happen in the next frame.
|
226 | * `async` is ideal for most apps, and if the app has many intensive tasks causing the main
|
227 | * thread to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers)
|
228 | * rather than the congestion async queue.
|
229 | *
|
230 | * - `congestionAsync`: DOM reads and writes are scheduled in the next frame to prevent layout
|
231 | * thrashing. When the app is heavily tasked and the queue becomes congested it will then
|
232 | * split the work across multiple frames to prevent blocking the main thread. However, it can
|
233 | * also introduce unnecessary reflows in some cases, especially during startup. `congestionAsync`
|
234 | * is ideal for apps running animations while also simultaneously executing intensive tasks
|
235 | * which may lock-up the main thread.
|
236 | *
|
237 | * - `immediate`: Makes writeTask() and readTask() callbacks to be executed synchronously. Tasks
|
238 | * are not scheduled to run in the next frame, but do note there is at least one microtask.
|
239 | * The `immediate` setting is ideal for apps that do not provide long running and smooth
|
240 | * animations. Like the async setting, if the app has intensive tasks causing the main thread
|
241 | * to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers).
|
242 | */
|
243 | taskQueue?: 'async' | 'immediate' | 'congestionAsync';
|
244 | /**
|
245 | * Provide a object of key/values accessible within the app, using the `Env` object.
|
246 | */
|
247 | env?: {
|
248 | [prop: string]: string | undefined;
|
249 | };
|
250 | docs?: StencilDocsConfig;
|
251 | globalScript?: string;
|
252 | srcIndexHtml?: string;
|
253 | watch?: boolean;
|
254 | testing?: TestingConfig;
|
255 | maxConcurrentWorkers?: number;
|
256 | preamble?: string;
|
257 | rollupPlugins?: {
|
258 | before?: any[];
|
259 | after?: any[];
|
260 | };
|
261 | entryComponentsHint?: string[];
|
262 | /**
|
263 | * Sets whether Stencil will write files to `dist/` during the build or not.
|
264 | *
|
265 | * By default this value is set to the opposite value of {@link devMode},
|
266 | * i.e. it will be `true` when building for production and `false` when
|
267 | * building for development.
|
268 | */
|
269 | buildDist?: boolean;
|
270 | buildLogFilePath?: string;
|
271 | devInspector?: boolean;
|
272 | devServer?: StencilDevServerConfig;
|
273 | sys?: CompilerSystem;
|
274 | tsconfig?: string;
|
275 | validateTypes?: boolean;
|
276 | /**
|
277 | * An array of RegExp patterns that are matched against all source files before adding
|
278 | * to the watch list in watch mode. If the file path matches any of the patterns, when it
|
279 | * is updated, it will not trigger a re-run of tests.
|
280 | */
|
281 | watchIgnoredRegex?: RegExp | RegExp[];
|
282 | /**
|
283 | * Set whether unused dependencies should be excluded from the built output.
|
284 | */
|
285 | excludeUnusedDependencies?: boolean;
|
286 | stencilCoreResolvedId?: string;
|
287 | }
|
288 | interface ConfigExtrasBase {
|
289 | /**
|
290 | * Experimental flag. Projects that use a Stencil library built using the `dist` output target may have trouble lazily
|
291 | * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
|
292 | * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
|
293 | * the size of the compiled output. Defaults to `false`.
|
294 | * @deprecated This flag has been deprecated in favor of `enableImportInjection`, which provides the same
|
295 | * functionality. `experimentalImportInjection` will be removed in a future major version of Stencil.
|
296 | */
|
297 | experimentalImportInjection?: boolean;
|
298 | /**
|
299 | * Projects that use a Stencil library built using the `dist` output target may have trouble lazily
|
300 | * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
|
301 | * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
|
302 | * the size of the compiled output. Defaults to `false`.
|
303 | */
|
304 | enableImportInjection?: boolean;
|
305 | /**
|
306 | * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
|
307 | */
|
308 | lifecycleDOMEvents?: boolean;
|
309 | /**
|
310 | * It is possible to assign data to the actual `<script>` element's `data-opts` property,
|
311 | * which then gets passed to Stencil's initial bootstrap. This feature is only required
|
312 | * for very special cases and rarely needed. Defaults to `false`.
|
313 | * @deprecated This option has been deprecated and will be removed in a future major version of Stencil.
|
314 | */
|
315 | scriptDataOpts?: boolean;
|
316 | /**
|
317 | * When a component is first attached to the DOM, this setting will wait a single tick before
|
318 | * rendering. This works around an Angular issue, where Angular attaches the elements before
|
319 | * settings their initial state, leading to double renders and unnecessary event dispatches.
|
320 | * Defaults to `false`.
|
321 | */
|
322 | initializeNextTick?: boolean;
|
323 | /**
|
324 | * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
|
325 | * can be customized at runtime. Defaults to `false`.
|
326 | */
|
327 | tagNameTransform?: boolean;
|
328 | /**
|
329 | * Experimental flag.
|
330 | * Updates the behavior of scoped components to align more closely with the behavior of the native
|
331 | * Shadow DOM when using `slot`s.
|
332 | *
|
333 | * Defaults to `false`.
|
334 | */
|
335 | experimentalScopedSlotChanges?: boolean;
|
336 | }
|
337 | type ConfigExtrasSlotFixes<ExperimentalFixesEnabled extends boolean, IndividualFlags extends boolean> = {
|
338 | /**
|
339 | * By default, the slot polyfill does not update `appendChild()` so that it appends
|
340 | * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
|
341 | * polyfill for those who need it when using `element.appendChild(node)` and expecting the
|
342 | * child to be appended in the same location shadow dom would. This is not required for
|
343 | * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
|
344 | */
|
345 | appendChildSlotFix?: IndividualFlags;
|
346 | /**
|
347 | * By default, the runtime does not polyfill `cloneNode()` when cloning a component
|
348 | * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
|
349 | * This is not required for IE11 or Edge 18, but can be enabled if the app is using
|
350 | * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
|
351 | * simulating shadow dom. Defaults to `false`.
|
352 | */
|
353 | cloneNodeFix?: IndividualFlags;
|
354 | /**
|
355 | * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
|
356 | * component that uses the shadow DOM. Defaults to `false`
|
357 | */
|
358 | scopedSlotTextContentFix?: IndividualFlags;
|
359 | /**
|
360 | * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
|
361 | * to simulate the same behavior. However, the host element's `childNodes` and `children`
|
362 | * getters are not patched to only show the child nodes and elements of the default slot.
|
363 | * Defaults to `false`.
|
364 | */
|
365 | slotChildNodesFix?: IndividualFlags;
|
366 | /**
|
367 | * Enables all slot-related fixes such as {@link slotChildNodesFix}, and
|
368 | * {@link scopedSlotTextContentFix}.
|
369 | */
|
370 | experimentalSlotFixes?: ExperimentalFixesEnabled;
|
371 | };
|
372 | export type ConfigExtras = ConfigExtrasBase & (ConfigExtrasSlotFixes<true, true> | ConfigExtrasSlotFixes<false, boolean>);
|
373 | export interface Config extends StencilConfig {
|
374 | buildAppCore?: boolean;
|
375 | buildDocs?: boolean;
|
376 | configPath?: string;
|
377 | writeLog?: boolean;
|
378 | devServer?: DevServerConfig;
|
379 | flags?: ConfigFlags;
|
380 | fsNamespace?: string;
|
381 | logLevel?: LogLevel;
|
382 | rootDir?: string;
|
383 | packageJsonFilePath?: string;
|
384 | suppressLogs?: boolean;
|
385 | profile?: boolean;
|
386 | tsCompilerOptions?: any;
|
387 | tsWatchOptions?: any;
|
388 | _isValidated?: boolean;
|
389 | _isTesting?: boolean;
|
390 | }
|
391 | /**
|
392 | * A 'loose' type useful for wrapping an incomplete / possible malformed
|
393 | * object as we work on getting it comply with a particular Interface T.
|
394 | *
|
395 | * Example:
|
396 | *
|
397 | * ```ts
|
398 | * interface Foo {
|
399 | * bar: string
|
400 | * }
|
401 | *
|
402 | * function validateFoo(foo: Loose<Foo>): Foo {
|
403 | * let validatedFoo = {
|
404 | * ...foo,
|
405 | * bar: foo.bar || DEFAULT_BAR
|
406 | * }
|
407 | *
|
408 | * return validatedFoo
|
409 | * }
|
410 | * ```
|
411 | *
|
412 | * Use this when you need to take user input or something from some other part
|
413 | * of the world that we don't control and transform it into something
|
414 | * conforming to a given interface. For best results, pair with a validation
|
415 | * function as shown in the example.
|
416 | */
|
417 | type Loose<T extends Object> = Record<string, any> & Partial<T>;
|
418 | /**
|
419 | * A Loose version of the Config interface. This is intended to let us load a partial config
|
420 | * and have type information carry though as we construct an object which is a valid `Config`.
|
421 | */
|
422 | export type UnvalidatedConfig = Loose<Config>;
|
423 | /**
|
424 | * Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
|
425 | * This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
|
426 | *
|
427 | * ```typescript
|
428 | * type Foo { bar?: number, baz?: string }
|
429 | * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
|
430 | * ```
|
431 | */
|
432 | type RequireFields<T, K extends keyof T> = T & {
|
433 | [P in K]-?: T[P];
|
434 | };
|
435 | /**
|
436 | * Fields in {@link Config} to make required for {@link ValidatedConfig}
|
437 | */
|
438 | type StrictConfigFields = keyof Pick<Config, 'buildEs5' | 'cacheDir' | 'devMode' | 'devServer' | 'extras' | 'flags' | 'fsNamespace' | 'hashFileNames' | 'hashedFileNameLength' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rollupConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'testing' | 'transformAliasedImportPaths' | 'validatePrimaryPackageOutputTarget'>;
|
439 | /**
|
440 | * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
|
441 | * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
|
442 | * about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
|
443 | * validations have occurred at runtime.
|
444 | */
|
445 | export type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
|
446 | export interface HydratedFlag {
|
447 | /**
|
448 | * Defaults to `hydrated`.
|
449 | */
|
450 | name?: string;
|
451 | /**
|
452 | * Can be either `class` or `attribute`. Defaults to `class`.
|
453 | */
|
454 | selector?: 'class' | 'attribute';
|
455 | /**
|
456 | * The CSS property used to show and hide components. Defaults to use the CSS `visibility`
|
457 | * property. Other commonly used CSS properties would be `display` with the `initialValue`
|
458 | * setting as `none`, or `opacity` with the `initialValue` as `0`. Defaults to `visibility`
|
459 | * and the default `initialValue` is `hidden`.
|
460 | */
|
461 | property?: string;
|
462 | /**
|
463 | * This is the CSS value to give all components before it has been hydrated.
|
464 | * Defaults to `hidden`.
|
465 | */
|
466 | initialValue?: string;
|
467 | /**
|
468 | * This is the CSS value to assign once a component has finished hydrating.
|
469 | * This is the CSS value that'll allow the component to show. Defaults to `inherit`.
|
470 | */
|
471 | hydratedValue?: string;
|
472 | }
|
473 | export interface StencilDevServerConfig {
|
474 | /**
|
475 | * IP address used by the dev server. The default is `0.0.0.0`, which points to all IPv4 addresses
|
476 | * on the local machine, such as `localhost`.
|
477 | */
|
478 | address?: string;
|
479 | /**
|
480 | * Base path to be used by the server. Defaults to the root pathname.
|
481 | */
|
482 | basePath?: string;
|
483 | /**
|
484 | * EXPERIMENTAL!
|
485 | * During development, node modules can be independently requested and bundled, making for
|
486 | * faster build times. This is only available using the Stencil Dev Server throughout
|
487 | * development. Production builds and builds with the `es5` flag will override
|
488 | * this setting to `false`. Default is `false`.
|
489 | */
|
490 | experimentalDevModules?: boolean;
|
491 | /**
|
492 | * If the dev server should respond with gzip compressed content. Defaults to `true`.
|
493 | */
|
494 | gzip?: boolean;
|
495 | /**
|
496 | * When set, the dev server will run via https using the SSL certificate and key you provide
|
497 | * (use `fs` if you want to read them from files).
|
498 | */
|
499 | https?: Credentials;
|
500 | /**
|
501 | * The URL the dev server should first open to. Defaults to `/`.
|
502 | */
|
503 | initialLoadUrl?: string;
|
504 | /**
|
505 | * When `true`, every request to the server will be logged within the terminal.
|
506 | * Defaults to `false`.
|
507 | */
|
508 | logRequests?: boolean;
|
509 | /**
|
510 | * By default, when dev server is started the local dev URL is opened in your default browser.
|
511 | * However, to prevent this URL to be opened change this value to `false`. Defaults to `true`.
|
512 | */
|
513 | openBrowser?: boolean;
|
514 | /**
|
515 | * Sets the server's port. Defaults to `3333`.
|
516 | */
|
517 | port?: number;
|
518 | /**
|
519 | * When files are watched and updated, by default the dev server will use `hmr` (Hot Module Replacement)
|
520 | * to update the page without a full page refresh. To have the page do a full refresh use `pageReload`.
|
521 | * To disable any reloading, use `null`. Defaults to `hmr`.
|
522 | */
|
523 | reloadStrategy?: PageReloadStrategy;
|
524 | /**
|
525 | * Local path to a NodeJs file with a dev server request listener as the default export.
|
526 | * The user's request listener is given the first chance to handle every request the dev server
|
527 | * receives, and can choose to handle it or instead pass it on to the default dev server
|
528 | * by calling `next()`.
|
529 | *
|
530 | * Below is an example of a NodeJs file the `requestListenerPath` config is using.
|
531 | * The request and response arguments are the same as Node's `http` module and `RequestListener`
|
532 | * callback. https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener
|
533 | *
|
534 | * ```js
|
535 | * module.exports = function (req, res, next) {
|
536 | * if (req.url === '/ping') {
|
537 | * // custom response overriding the dev server
|
538 | * res.setHeader('Content-Type', 'text/plain');
|
539 | * res.writeHead(200);
|
540 | * res.end('pong');
|
541 | * } else {
|
542 | * // pass request on to the default dev server
|
543 | * next();
|
544 | * }
|
545 | * };
|
546 | * ```
|
547 | */
|
548 | requestListenerPath?: string;
|
549 | /**
|
550 | * The root directory to serve the files from.
|
551 | */
|
552 | root?: string;
|
553 | /**
|
554 | * If the dev server should Server-Side Render (SSR) each page, meaning it'll dynamically generate
|
555 | * server-side rendered html on each page load. The `--ssr` flag will most commonly be used with
|
556 | * the`--dev --watch --serve` flags during development. Note that this is for development purposes
|
557 | * only, and the built-in dev server should not be used for production. Defaults to `false`.
|
558 | */
|
559 | ssr?: boolean;
|
560 | /**
|
561 | * If the dev server fails to start up within the given timeout (in milliseconds), the startup will
|
562 | * be canceled. Set to zero to disable the timeout. Defaults to `15000`.
|
563 | */
|
564 | startupTimeout?: number;
|
565 | /**
|
566 | * Whether to use the dev server's websocket client or not. Defaults to `true`.
|
567 | */
|
568 | websocket?: boolean;
|
569 | /**
|
570 | * If the dev server should fork a worker for the server process or not. A singled-threaded dev server
|
571 | * is slower, however it is useful for debugging http requests and responses. Defaults to `true`.
|
572 | */
|
573 | worker?: boolean;
|
574 | }
|
575 | export interface DevServerConfig extends StencilDevServerConfig {
|
576 | browserUrl?: string;
|
577 | devServerDir?: string;
|
578 | /**
|
579 | * A list of glob patterns like `subdir/*.js` to exclude from hot-module
|
580 | * reloading updates.
|
581 | */
|
582 | excludeHmr?: string[];
|
583 | historyApiFallback?: HistoryApiFallback;
|
584 | openBrowser?: boolean;
|
585 | prerenderConfig?: string;
|
586 | protocol?: 'http' | 'https';
|
587 | srcIndexHtml?: string;
|
588 | /**
|
589 | * Route to be used for the "ping" sub-route of the Stencil dev server.
|
590 | * This route will return a 200 status code once the Stencil build has finished.
|
591 | * Setting this to `null` will disable the ping route.
|
592 | *
|
593 | * Defaults to `/ping`
|
594 | */
|
595 | pingRoute?: string | null;
|
596 | }
|
597 | export interface HistoryApiFallback {
|
598 | index?: string;
|
599 | disableDotRule?: boolean;
|
600 | }
|
601 | export interface DevServerEditor {
|
602 | id: string;
|
603 | name?: string;
|
604 | supported?: boolean;
|
605 | priority?: number;
|
606 | }
|
607 | export type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
|
608 | export type PageReloadStrategy = 'hmr' | 'pageReload' | null;
|
609 | /**
|
610 | * The prerender config is used when prerendering a `www` output target.
|
611 | * Within `stencil.config.ts`, set the path to the prerendering
|
612 | * config file path using the `prerenderConfig` property, such as:
|
613 | *
|
614 | * ```tsx
|
615 | * import { Config } from '@stencil/core';
|
616 | * export const config: Config = {
|
617 | * outputTargets: [
|
618 | * {
|
619 | * type: 'www',
|
620 | * baseUrl: 'https://stenciljs.com/',
|
621 | * prerenderConfig: './prerender.config.ts',
|
622 | * }
|
623 | * ]
|
624 | * };
|
625 | * ```
|
626 | *
|
627 | * The `prerender.config.ts` should export a `config` object using
|
628 | * the `PrerenderConfig` interface.
|
629 | *
|
630 | * ```tsx
|
631 | * import { PrerenderConfig } from '@stencil/core';
|
632 | * export const config: PrerenderConfig = {
|
633 | * ...
|
634 | * };
|
635 | * ```
|
636 | *
|
637 | * For more info: https://stenciljs.com/docs/static-site-generation
|
638 | */
|
639 | export interface PrerenderConfig {
|
640 | /**
|
641 | * Run after each `document` is hydrated, but before it is serialized
|
642 | * into an HTML string. Hook is passed the `document` and its `URL`.
|
643 | */
|
644 | afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
|
645 | /**
|
646 | * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
|
647 | */
|
648 | beforeHydrate?(document: Document, url: URL): any | Promise<any>;
|
649 | /**
|
650 | * Runs after the template Document object has serialize into an
|
651 | * HTML formatted string. Returns an HTML string to be used as the
|
652 | * base template for all prerendered pages.
|
653 | */
|
654 | afterSerializeTemplate?(html: string): string | Promise<string>;
|
655 | /**
|
656 | * Runs before the template Document object is serialize into an
|
657 | * HTML formatted string. Returns the Document to be serialized which
|
658 | * will become the base template html for all prerendered pages.
|
659 | */
|
660 | beforeSerializeTemplate?(document: Document): Document | Promise<Document>;
|
661 | /**
|
662 | * A hook to be used to generate the canonical `<link>` tag
|
663 | * which goes in the `<head>` of every prerendered page. Returning `null`
|
664 | * will not add a canonical url tag to the page.
|
665 | */
|
666 | canonicalUrl?(url: URL): string | null;
|
667 | /**
|
668 | * While prerendering, crawl same-origin URLs found within `<a href>` elements.
|
669 | * Defaults to `true`.
|
670 | */
|
671 | crawlUrls?: boolean;
|
672 | /**
|
673 | * URLs to start the prerendering from. By default the root URL of `/` is used.
|
674 | */
|
675 | entryUrls?: string[];
|
676 | /**
|
677 | * Return `true` the given `<a>` element should be crawled or not.
|
678 | */
|
679 | filterAnchor?(attrs: {
|
680 | [attrName: string]: string;
|
681 | }, base?: URL): boolean;
|
682 | /**
|
683 | * Return `true` if the given URL should be prerendered or not.
|
684 | */
|
685 | filterUrl?(url: URL, base: URL): boolean;
|
686 | /**
|
687 | * Returns the file path which the prerendered HTML content
|
688 | * should be written to.
|
689 | */
|
690 | filePath?(url: URL, filePath: string): string;
|
691 | /**
|
692 | * Returns the hydrate options to use for each individual prerendered page.
|
693 | */
|
694 | hydrateOptions?(url: URL): PrerenderHydrateOptions;
|
695 | /**
|
696 | * Returns the template file's content. The template is the base
|
697 | * HTML used for all prerendered pages.
|
698 | */
|
699 | loadTemplate?(filePath: string): string | Promise<string>;
|
700 | /**
|
701 | * Used to normalize the page's URL from a given a string and the current
|
702 | * page's base URL. Largely used when reading an anchor's `href` attribute
|
703 | * value and normalizing it into a `URL`.
|
704 | */
|
705 | normalizeUrl?(href: string, base: URL): URL;
|
706 | robotsTxt?(opts: RobotsTxtOpts): string | RobotsTxtResults;
|
707 | sitemapXml?(opts: SitemapXmpOpts): string | SitemapXmpResults;
|
708 | /**
|
709 | * Static Site Generated (SSG). Does not include Stencil's client-side
|
710 | * JavaScript, custom elements or preload modules.
|
711 | */
|
712 | staticSite?: boolean;
|
713 | /**
|
714 | * If the prerendered URLs should have a trailing "/"" or not. Defaults to `false`.
|
715 | */
|
716 | trailingSlash?: boolean;
|
717 | }
|
718 | export interface HydrateDocumentOptions {
|
719 | /**
|
720 | * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
|
721 | * a random ID will be generated
|
722 | */
|
723 | buildId?: string;
|
724 | /**
|
725 | * Sets the `href` attribute on the `<link rel="canonical">`
|
726 | * tag within the `<head>`. If the value is not defined it will
|
727 | * ensure a canonical link tag is no included in the `<head>`.
|
728 | */
|
729 | canonicalUrl?: string;
|
730 | /**
|
731 | * Include the HTML comments and attributes used by the client-side
|
732 | * JavaScript to read the structure of the HTML and rebuild each
|
733 | * component. Defaults to `true`.
|
734 | */
|
735 | clientHydrateAnnotations?: boolean;
|
736 | /**
|
737 | * Constrain `setTimeout()` to 1ms, but still async. Also
|
738 | * only allows `setInterval()` to fire once, also constrained to 1ms.
|
739 | * Defaults to `true`.
|
740 | */
|
741 | constrainTimeouts?: boolean;
|
742 | /**
|
743 | * Sets `document.cookie`
|
744 | */
|
745 | cookie?: string;
|
746 | /**
|
747 | * Sets the `dir` attribute on the top level `<html>`.
|
748 | */
|
749 | direction?: string;
|
750 | /**
|
751 | * Component tag names listed here will not be prerendered, nor will
|
752 | * hydrated on the client-side. Components listed here will be ignored
|
753 | * as custom elements and treated no differently than a `<div>`.
|
754 | */
|
755 | excludeComponents?: string[];
|
756 | /**
|
757 | * Sets the `lang` attribute on the top level `<html>`.
|
758 | */
|
759 | language?: string;
|
760 | /**
|
761 | * Maximum number of components to hydrate on one page. Defaults to `300`.
|
762 | */
|
763 | maxHydrateCount?: number;
|
764 | /**
|
765 | * Sets `document.referrer`
|
766 | */
|
767 | referrer?: string;
|
768 | /**
|
769 | * Removes every `<script>` element found in the `document`. Defaults to `false`.
|
770 | */
|
771 | removeScripts?: boolean;
|
772 | /**
|
773 | * Removes CSS not used by elements within the `document`. Defaults to `true`.
|
774 | */
|
775 | removeUnusedStyles?: boolean;
|
776 | /**
|
777 | * The url the runtime uses for the resources, such as the assets directory.
|
778 | */
|
779 | resourcesUrl?: string;
|
780 | /**
|
781 | * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
|
782 | */
|
783 | runtimeLogging?: boolean;
|
784 | /**
|
785 | * Component tags listed here will only be prerendered or server-side-rendered
|
786 | * and will not be client-side hydrated. This is useful for components that
|
787 | * are not dynamic and do not need to be defined as a custom element within the
|
788 | * browser. For example, a header or footer component would be a good example that
|
789 | * may not require any client-side JavaScript.
|
790 | */
|
791 | staticComponents?: string[];
|
792 | /**
|
793 | * The amount of milliseconds to wait for a page to finish rendering until
|
794 | * a timeout error is thrown. Defaults to `15000`.
|
795 | */
|
796 | timeout?: number;
|
797 | /**
|
798 | * Sets `document.title`.
|
799 | */
|
800 | title?: string;
|
801 | /**
|
802 | * Sets `location.href`
|
803 | */
|
804 | url?: string;
|
805 | /**
|
806 | * Sets `navigator.userAgent`
|
807 | */
|
808 | userAgent?: string;
|
809 | }
|
810 | export interface SerializeDocumentOptions extends HydrateDocumentOptions {
|
811 | /**
|
812 | * Runs after the `document` has been hydrated.
|
813 | */
|
814 | afterHydrate?(document: any): any | Promise<any>;
|
815 | /**
|
816 | * Sets an approximate line width the HTML should attempt to stay within.
|
817 | * Note that this is "approximate", in that HTML may often not be able
|
818 | * to be split at an exact line width. Additionally, new lines created
|
819 | * is where HTML naturally already has whitespace, such as before an
|
820 | * attribute or spaces between words. Defaults to `100`.
|
821 | */
|
822 | approximateLineWidth?: number;
|
823 | /**
|
824 | * Runs before the `document` has been hydrated.
|
825 | */
|
826 | beforeHydrate?(document: any): any | Promise<any>;
|
827 | /**
|
828 | * Format the HTML in a nicely indented format.
|
829 | * Defaults to `false`.
|
830 | */
|
831 | prettyHtml?: boolean;
|
832 | /**
|
833 | * Remove quotes from attribute values when possible.
|
834 | * Defaults to `true`.
|
835 | */
|
836 | removeAttributeQuotes?: boolean;
|
837 | /**
|
838 | * Remove the `=""` from standardized `boolean` attributes,
|
839 | * such as `hidden` or `checked`. Defaults to `true`.
|
840 | */
|
841 | removeBooleanAttributeQuotes?: boolean;
|
842 | /**
|
843 | * Remove these standardized attributes when their value is empty:
|
844 | * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
|
845 | */
|
846 | removeEmptyAttributes?: boolean;
|
847 | /**
|
848 | * Remove HTML comments. Defaults to `true`.
|
849 | */
|
850 | removeHtmlComments?: boolean;
|
851 | /**
|
852 | * If set to `true` the component will be rendered within a Declarative Shadow DOM.
|
853 | * If set to `false` Stencil will ignore the contents of the shadow root and render the
|
854 | * element as given in provided template.
|
855 | * @default true
|
856 | */
|
857 | serializeShadowRoot?: boolean;
|
858 | /**
|
859 | * The `fullDocument` flag determines the format of the rendered output. Set it to true to
|
860 | * generate a complete HTML document, or false to render only the component.
|
861 | * @default true
|
862 | */
|
863 | fullDocument?: boolean;
|
864 | /**
|
865 | * Style modes to render the component in.
|
866 | * @see https://stenciljs.com/docs/styling#style-modes
|
867 | */
|
868 | modes?: ResolutionHandler[];
|
869 | }
|
870 | export interface HydrateFactoryOptions extends SerializeDocumentOptions {
|
871 | serializeToHtml: boolean;
|
872 | destroyWindow: boolean;
|
873 | destroyDocument: boolean;
|
874 | }
|
875 | export interface PrerenderHydrateOptions extends SerializeDocumentOptions {
|
876 | /**
|
877 | * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
|
878 | * Defaults to `true`.
|
879 | */
|
880 | addModulePreloads?: boolean;
|
881 | /**
|
882 | * Hash the content of assets, such as images, fonts and css files,
|
883 | * and add the hashed value as `v` querystring. For example,
|
884 | * `/assets/image.png?v=abcd1234`. This allows for assets to be
|
885 | * heavily cached by setting the server's response header with
|
886 | * `Cache-Control: max-age=31536000, immutable`.
|
887 | */
|
888 | hashAssets?: 'querystring';
|
889 | /**
|
890 | * External stylesheets from `<link rel="stylesheet">` are instead inlined
|
891 | * into `<style>` elements. Defaults to `false`.
|
892 | */
|
893 | inlineExternalStyleSheets?: boolean;
|
894 | /**
|
895 | * Minify CSS content within `<style>` elements. Defaults to `true`.
|
896 | */
|
897 | minifyStyleElements?: boolean;
|
898 | /**
|
899 | * Minify JavaScript content within `<script>` elements. Defaults to `true`.
|
900 | */
|
901 | minifyScriptElements?: boolean;
|
902 | /**
|
903 | * Entire `document` should be static. This is useful for specific pages that
|
904 | * should be static, rather than the entire site. If the whole site should be static,
|
905 | * use the `staticSite` property on the prerender config instead. If only certain
|
906 | * components should be static then use `staticComponents` instead.
|
907 | */
|
908 | staticDocument?: boolean;
|
909 | }
|
910 | export interface RobotsTxtOpts {
|
911 | urls: string[];
|
912 | sitemapUrl: string;
|
913 | baseUrl: string;
|
914 | dir: string;
|
915 | }
|
916 | export interface RobotsTxtResults {
|
917 | content: string;
|
918 | filePath: string;
|
919 | url: string;
|
920 | }
|
921 | export interface SitemapXmpOpts {
|
922 | urls: string[];
|
923 | baseUrl: string;
|
924 | dir: string;
|
925 | }
|
926 | export interface SitemapXmpResults {
|
927 | content: string;
|
928 | filePath: string;
|
929 | url: string;
|
930 | }
|
931 | /**
|
932 | * Common system used by the compiler. All file reads, writes, access, etc. will all use
|
933 | * this system. Additionally, throughout each build, the compiler will use an internal
|
934 | * in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
|
935 | * build all actions the in-memory fs performed will be written to disk using this system.
|
936 | * A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
|
937 | * will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
|
938 | * of the actual platform it's being ran on top of.
|
939 | */
|
940 | export interface CompilerSystem {
|
941 | name: 'node' | 'in-memory';
|
942 | version: string;
|
943 | events?: BuildEvents;
|
944 | details?: SystemDetails;
|
945 | /**
|
946 | * Add a callback which will be ran when destroy() is called.
|
947 | */
|
948 | addDestroy(cb: () => void): void;
|
949 | /**
|
950 | * Always returns a boolean, does not throw.
|
951 | */
|
952 | access(p: string): Promise<boolean>;
|
953 | /**
|
954 | * SYNC! Always returns a boolean, does not throw.
|
955 | */
|
956 | accessSync(p: string): boolean;
|
957 | applyGlobalPatch?(fromDir: string): Promise<void>;
|
958 | applyPrerenderGlobalPatch?(opts: {
|
959 | devServerHostUrl: string;
|
960 | window: any;
|
961 | }): void;
|
962 | cacheStorage?: CacheStorage;
|
963 | checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
|
964 | copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
|
965 | /**
|
966 | * Always returns a boolean if the files were copied or not. Does not throw.
|
967 | */
|
968 | copyFile(src: string, dst: string): Promise<boolean>;
|
969 | /**
|
970 | * Used to destroy any listeners, file watchers or child processes.
|
971 | */
|
972 | destroy(): Promise<void>;
|
973 | /**
|
974 | * Does not throw.
|
975 | */
|
976 | createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
|
977 | /**
|
978 | * SYNC! Does not throw.
|
979 | */
|
980 | createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
|
981 | homeDir(): string;
|
982 | /**
|
983 | * Used to determine if the current context of the terminal is TTY.
|
984 | */
|
985 | isTTY(): boolean;
|
986 | /**
|
987 | * Each platform has a different way to dynamically import modules.
|
988 | */
|
989 | dynamicImport?(p: string): Promise<any>;
|
990 | /**
|
991 | * Creates the worker controller for the current system.
|
992 | *
|
993 | * @param maxConcurrentWorkers the max number of concurrent workers to
|
994 | * support
|
995 | * @returns a worker controller appropriate for the current platform (node.js)
|
996 | */
|
997 | createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
|
998 | encodeToBase64(str: string): string;
|
999 | /**
|
1000 | * @deprecated
|
1001 | */
|
1002 | ensureDependencies?(opts: {
|
1003 | rootDir: string;
|
1004 | logger: Logger;
|
1005 | dependencies: CompilerDependency[];
|
1006 | }): Promise<{
|
1007 | stencilPath: string;
|
1008 | diagnostics: Diagnostic[];
|
1009 | }>;
|
1010 | /**
|
1011 | * @deprecated
|
1012 | */
|
1013 | ensureResources?(opts: {
|
1014 | rootDir: string;
|
1015 | logger: Logger;
|
1016 | dependencies: CompilerDependency[];
|
1017 | }): Promise<void>;
|
1018 | /**
|
1019 | * process.exit()
|
1020 | */
|
1021 | exit(exitCode: number): Promise<void>;
|
1022 | /**
|
1023 | * Optionally provide a fetch() function rather than using the built-in fetch().
|
1024 | * First arg is a url string or Request object (RequestInfo).
|
1025 | * Second arg is the RequestInit. Returns the Response object
|
1026 | */
|
1027 | fetch?(input: string | any, init?: any): Promise<any>;
|
1028 | /**
|
1029 | * Generates a sha1 digest encoded as HEX
|
1030 | */
|
1031 | generateContentHash?(content: string | any, length?: number): Promise<string>;
|
1032 | /**
|
1033 | * Generates a sha1 digest encoded as HEX from a file path
|
1034 | */
|
1035 | generateFileHash?(filePath: string | any, length?: number): Promise<string>;
|
1036 | /**
|
1037 | * Get the current directory.
|
1038 | */
|
1039 | getCurrentDirectory(): string;
|
1040 | /**
|
1041 | * The compiler's executing path.
|
1042 | */
|
1043 | getCompilerExecutingPath(): string;
|
1044 | /**
|
1045 | * The dev server's executing path.
|
1046 | */
|
1047 | getDevServerExecutingPath?(): string;
|
1048 | getEnvironmentVar?(key: string): string;
|
1049 | /**
|
1050 | * Gets the absolute file path when for a dependency module.
|
1051 | */
|
1052 | getLocalModulePath(opts: {
|
1053 | rootDir: string;
|
1054 | moduleId: string;
|
1055 | path: string;
|
1056 | }): string;
|
1057 | /**
|
1058 | * Gets the full url when requesting a dependency module to fetch from a CDN.
|
1059 | */
|
1060 | getRemoteModuleUrl(opts: {
|
1061 | moduleId: string;
|
1062 | path?: string;
|
1063 | version?: string;
|
1064 | }): string;
|
1065 | /**
|
1066 | * Async glob task. Only available in NodeJS compiler system.
|
1067 | */
|
1068 | glob?(pattern: string, options: {
|
1069 | cwd?: string;
|
1070 | nodir?: boolean;
|
1071 | [key: string]: any;
|
1072 | }): Promise<string[]>;
|
1073 | /**
|
1074 | * The number of logical processors available to run threads on the user's computer (cpus).
|
1075 | */
|
1076 | hardwareConcurrency: number;
|
1077 | /**
|
1078 | * Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
|
1079 | */
|
1080 | isSymbolicLink(p: string): Promise<boolean>;
|
1081 | lazyRequire?: LazyRequire;
|
1082 | nextTick(cb: () => void): void;
|
1083 | /**
|
1084 | * Normalize file system path.
|
1085 | */
|
1086 | normalizePath(p: string): string;
|
1087 | onProcessInterrupt?(cb: () => void): void;
|
1088 | parseYarnLockFile?: (content: string) => {
|
1089 | type: 'success' | 'merge' | 'conflict';
|
1090 | object: any;
|
1091 | };
|
1092 | platformPath: PlatformPath;
|
1093 | /**
|
1094 | * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
|
1095 | */
|
1096 | readDir(p: string): Promise<string[]>;
|
1097 | /**
|
1098 | * SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
|
1099 | */
|
1100 | readDirSync(p: string): string[];
|
1101 | /**
|
1102 | * Returns undefined if file is not found. Does not throw.
|
1103 | */
|
1104 | readFile(p: string): Promise<string>;
|
1105 | readFile(p: string, encoding: 'utf8'): Promise<string>;
|
1106 | readFile(p: string, encoding: 'binary'): Promise<any>;
|
1107 | /**
|
1108 | * SYNC! Returns undefined if file is not found. Does not throw.
|
1109 | */
|
1110 | readFileSync(p: string, encoding?: string): string;
|
1111 | /**
|
1112 | * Does not throw.
|
1113 | */
|
1114 | realpath(p: string): Promise<CompilerSystemRealpathResults>;
|
1115 | /**
|
1116 | * SYNC! Does not throw.
|
1117 | */
|
1118 | realpathSync(p: string): CompilerSystemRealpathResults;
|
1119 | /**
|
1120 | * Remove a callback which will be ran when destroy() is called.
|
1121 | */
|
1122 | removeDestroy(cb: () => void): void;
|
1123 | /**
|
1124 | * Rename old path to new path. Does not throw.
|
1125 | */
|
1126 | rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
|
1127 | resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
|
1128 | resolvePath(p: string): string;
|
1129 | /**
|
1130 | * Does not throw.
|
1131 | */
|
1132 | removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
|
1133 | /**
|
1134 | * SYNC! Does not throw.
|
1135 | */
|
1136 | removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
|
1137 | /**
|
1138 | * Does not throw.
|
1139 | */
|
1140 | removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
|
1141 | /**
|
1142 | * SYNC! Does not throw.
|
1143 | */
|
1144 | removeFileSync(p: string): CompilerSystemRemoveFileResults;
|
1145 | setupCompiler?: (c: {
|
1146 | ts: any;
|
1147 | }) => void;
|
1148 | /**
|
1149 | * Always returns an object. Does not throw. Check for "error" property if there's an error.
|
1150 | */
|
1151 | stat(p: string): Promise<CompilerFsStats>;
|
1152 | /**
|
1153 | * SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
|
1154 | */
|
1155 | statSync(p: string): CompilerFsStats;
|
1156 | tmpDirSync(): string;
|
1157 | watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
|
1158 | /**
|
1159 | * A `watchFile` implementation in order to hook into the rest of the {@link CompilerSystem} implementation that is
|
1160 | * used when running Stencil's compiler in "watch mode".
|
1161 | *
|
1162 | * It is analogous to TypeScript's `watchFile` implementation.
|
1163 | *
|
1164 | * Note, this function may be called for full builds of Stencil projects by the TypeScript compiler. It should not
|
1165 | * assume that it will only be called in watch mode.
|
1166 | *
|
1167 | * This function should not perform any file watcher registration itself. Each `path` provided to it when called
|
1168 | * should already have been registered as a file to watch.
|
1169 | *
|
1170 | * @param path the path to the file that is being watched
|
1171 | * @param callback a callback to invoke when a file that is being watched has changed in some way
|
1172 | * @returns an object with a method for unhooking the file watcher from the system
|
1173 | */
|
1174 | watchFile?(path: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
|
1175 | /**
|
1176 | * How many milliseconds to wait after a change before calling watch callbacks.
|
1177 | */
|
1178 | watchTimeout?: number;
|
1179 | /**
|
1180 | * Does not throw.
|
1181 | */
|
1182 | writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
|
1183 | /**
|
1184 | * SYNC! Does not throw.
|
1185 | */
|
1186 | writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
|
1187 | }
|
1188 | export interface TranspileOnlyResults {
|
1189 | diagnostics: Diagnostic[];
|
1190 | output: string;
|
1191 | sourceMap: any;
|
1192 | }
|
1193 | export interface ParsedPath {
|
1194 | root: string;
|
1195 | dir: string;
|
1196 | base: string;
|
1197 | ext: string;
|
1198 | name: string;
|
1199 | }
|
1200 | export interface PlatformPath {
|
1201 | normalize(p: string): string;
|
1202 | join(...paths: string[]): string;
|
1203 | resolve(...pathSegments: string[]): string;
|
1204 | isAbsolute(p: string): boolean;
|
1205 | relative(from: string, to: string): string;
|
1206 | dirname(p: string): string;
|
1207 | basename(p: string, ext?: string): string;
|
1208 | extname(p: string): string;
|
1209 | parse(p: string): ParsedPath;
|
1210 | sep: string;
|
1211 | delimiter: string;
|
1212 | posix: any;
|
1213 | win32: any;
|
1214 | }
|
1215 | export interface CompilerDependency {
|
1216 | name: string;
|
1217 | version: string;
|
1218 | main: string;
|
1219 | resources?: string[];
|
1220 | }
|
1221 | export interface ResolveModuleIdOptions {
|
1222 | moduleId: string;
|
1223 | containingFile?: string;
|
1224 | exts?: string[];
|
1225 | packageFilter?: (pkg: any) => void;
|
1226 | }
|
1227 | export interface ResolveModuleIdResults {
|
1228 | moduleId: string;
|
1229 | resolveId: string;
|
1230 | pkgData: {
|
1231 | name: string;
|
1232 | version: string;
|
1233 | [key: string]: any;
|
1234 | };
|
1235 | pkgDirPath: string;
|
1236 | }
|
1237 | /**
|
1238 | * A controller which provides for communication and coordination between
|
1239 | * threaded workers.
|
1240 | */
|
1241 | export interface WorkerMainController {
|
1242 | /**
|
1243 | * Send a given set of arguments to a worker
|
1244 | */
|
1245 | send(...args: any[]): Promise<any>;
|
1246 | /**
|
1247 | * Handle a particular method
|
1248 | *
|
1249 | * @param name of the method to be passed to a worker
|
1250 | * @returns a Promise wrapping the results
|
1251 | */
|
1252 | handler(name: string): (...args: any[]) => Promise<any>;
|
1253 | /**
|
1254 | * Destroy the worker represented by this instance, rejecting all outstanding
|
1255 | * tasks and killing the child process.
|
1256 | */
|
1257 | destroy(): void;
|
1258 | /**
|
1259 | * The current setting for the max number of workers
|
1260 | */
|
1261 | maxWorkers: number;
|
1262 | }
|
1263 | export interface CopyResults {
|
1264 | diagnostics: Diagnostic[];
|
1265 | filePaths: string[];
|
1266 | dirPaths: string[];
|
1267 | }
|
1268 | export interface SystemDetails {
|
1269 | cpuModel: string;
|
1270 | freemem(): number;
|
1271 | platform: 'darwin' | 'windows' | 'linux' | '';
|
1272 | release: string;
|
1273 | totalmem: number;
|
1274 | }
|
1275 | export interface BuildOnEvents {
|
1276 | on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
|
1277 | on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
|
1278 | on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
|
1279 | on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
|
1280 | on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
|
1281 | on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
|
1282 | on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
|
1283 | on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
|
1284 | on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
|
1285 | on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
|
1286 | }
|
1287 | export interface BuildEmitEvents {
|
1288 | emit(eventName: CompilerEventName, path: string): void;
|
1289 | emit(eventName: CompilerEventFileAdd, path: string): void;
|
1290 | emit(eventName: CompilerEventFileDelete, path: string): void;
|
1291 | emit(eventName: CompilerEventFileUpdate, path: string): void;
|
1292 | emit(eventName: CompilerEventDirAdd, path: string): void;
|
1293 | emit(eventName: CompilerEventDirDelete, path: string): void;
|
1294 | emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
|
1295 | emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
|
1296 | emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
|
1297 | emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
|
1298 | emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
|
1299 | }
|
1300 | export interface FsWatchResults {
|
1301 | dirsAdded: string[];
|
1302 | dirsDeleted: string[];
|
1303 | filesUpdated: string[];
|
1304 | filesAdded: string[];
|
1305 | filesDeleted: string[];
|
1306 | }
|
1307 | export interface BuildLog {
|
1308 | buildId: number;
|
1309 | messages: string[];
|
1310 | progress: number;
|
1311 | }
|
1312 | export interface BuildNoChangeResults {
|
1313 | buildId: number;
|
1314 | noChange: boolean;
|
1315 | }
|
1316 | export interface CompilerBuildResults {
|
1317 | buildId: number;
|
1318 | componentGraph?: BuildResultsComponentGraph;
|
1319 | diagnostics: Diagnostic[];
|
1320 | dirsAdded: string[];
|
1321 | dirsDeleted: string[];
|
1322 | duration: number;
|
1323 | filesAdded: string[];
|
1324 | filesChanged: string[];
|
1325 | filesDeleted: string[];
|
1326 | filesUpdated: string[];
|
1327 | hasError: boolean;
|
1328 | hasSuccessfulBuild: boolean;
|
1329 | hmr?: HotModuleReplacement;
|
1330 | hydrateAppFilePath?: string;
|
1331 | isRebuild: boolean;
|
1332 | namespace: string;
|
1333 | outputs: BuildOutput[];
|
1334 | rootDir: string;
|
1335 | srcDir: string;
|
1336 | timestamp: string;
|
1337 | }
|
1338 | export interface BuildResultsComponentGraph {
|
1339 | [scopeId: string]: string[];
|
1340 | }
|
1341 | export interface BuildOutput {
|
1342 | type: string;
|
1343 | files: string[];
|
1344 | }
|
1345 | export interface HotModuleReplacement {
|
1346 | componentsUpdated?: string[];
|
1347 | excludeHmr?: string[];
|
1348 | externalStylesUpdated?: string[];
|
1349 | imagesUpdated?: string[];
|
1350 | indexHtmlUpdated?: boolean;
|
1351 | inlineStylesUpdated?: HmrStyleUpdate[];
|
1352 | reloadStrategy: PageReloadStrategy;
|
1353 | scriptsAdded?: string[];
|
1354 | scriptsDeleted?: string[];
|
1355 | serviceWorkerUpdated?: boolean;
|
1356 | versionId?: string;
|
1357 | }
|
1358 | export interface HmrStyleUpdate {
|
1359 | styleId: string;
|
1360 | styleTag: string;
|
1361 | styleText: string;
|
1362 | }
|
1363 | export type BuildOnEventRemove = () => boolean;
|
1364 | export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
|
1365 | unsubscribeAll(): void;
|
1366 | }
|
1367 | export interface CompilerBuildStart {
|
1368 | buildId: number;
|
1369 | timestamp: string;
|
1370 | }
|
1371 | /**
|
1372 | * A type describing a function to call when an event is emitted by a file watcher
|
1373 | * @param fileName the path of the file tied to event
|
1374 | * @param eventKind a variant describing the type of event that was emitter (added, edited, etc.)
|
1375 | */
|
1376 | export type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
|
1377 | /**
|
1378 | * A type describing the different types of events that Stencil expects may happen when a file being watched is altered
|
1379 | * in some way
|
1380 | */
|
1381 | export type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
|
1382 | export type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
|
1383 | export type CompilerEventFsChange = 'fsChange';
|
1384 | export type CompilerEventFileUpdate = 'fileUpdate';
|
1385 | export type CompilerEventFileAdd = 'fileAdd';
|
1386 | export type CompilerEventFileDelete = 'fileDelete';
|
1387 | export type CompilerEventDirAdd = 'dirAdd';
|
1388 | export type CompilerEventDirDelete = 'dirDelete';
|
1389 | export type CompilerEventBuildStart = 'buildStart';
|
1390 | export type CompilerEventBuildFinish = 'buildFinish';
|
1391 | export type CompilerEventBuildLog = 'buildLog';
|
1392 | export type CompilerEventBuildNoChange = 'buildNoChange';
|
1393 | export interface CompilerFileWatcher {
|
1394 | close(): void | Promise<void>;
|
1395 | }
|
1396 | export interface CompilerFsStats {
|
1397 | /**
|
1398 | * If it's a directory. `false` if there was an error.
|
1399 | */
|
1400 | isDirectory: boolean;
|
1401 | /**
|
1402 | * If it's a file. `false` if there was an error.
|
1403 | */
|
1404 | isFile: boolean;
|
1405 | /**
|
1406 | * If it's a symlink. `false` if there was an error.
|
1407 | */
|
1408 | isSymbolicLink: boolean;
|
1409 | /**
|
1410 | * The size of the file in bytes. `0` for directories or if there was an error.
|
1411 | */
|
1412 | size: number;
|
1413 | /**
|
1414 | * The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
|
1415 | */
|
1416 | mtimeMs?: number;
|
1417 | /**
|
1418 | * Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
|
1419 | */
|
1420 | error: any;
|
1421 | }
|
1422 | export interface CompilerSystemCreateDirectoryOptions {
|
1423 | /**
|
1424 | * Indicates whether parent directories should be created.
|
1425 | * @default false
|
1426 | */
|
1427 | recursive?: boolean;
|
1428 | /**
|
1429 | * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
1430 | * @default 0o777.
|
1431 | */
|
1432 | mode?: number;
|
1433 | }
|
1434 | export interface CompilerSystemCreateDirectoryResults {
|
1435 | basename: string;
|
1436 | dirname: string;
|
1437 | path: string;
|
1438 | newDirs: string[];
|
1439 | error: any;
|
1440 | }
|
1441 | export interface CompilerSystemRemoveDirectoryOptions {
|
1442 | /**
|
1443 | * Indicates whether child files and subdirectories should be removed.
|
1444 | * @default false
|
1445 | */
|
1446 | recursive?: boolean;
|
1447 | }
|
1448 | export interface CompilerSystemRemoveDirectoryResults {
|
1449 | basename: string;
|
1450 | dirname: string;
|
1451 | path: string;
|
1452 | removedDirs: string[];
|
1453 | removedFiles: string[];
|
1454 | error: any;
|
1455 | }
|
1456 | export interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
|
1457 | renamed: CompilerSystemRenamedPath[];
|
1458 | oldDirs: string[];
|
1459 | oldFiles: string[];
|
1460 | newDirs: string[];
|
1461 | newFiles: string[];
|
1462 | error: any;
|
1463 | }
|
1464 | export interface CompilerSystemRenamedPath {
|
1465 | oldPath: string;
|
1466 | newPath: string;
|
1467 | isFile: boolean;
|
1468 | isDirectory: boolean;
|
1469 | }
|
1470 | export interface CompilerSystemRealpathResults {
|
1471 | path: string;
|
1472 | error: any;
|
1473 | }
|
1474 | export interface CompilerSystemRemoveFileResults {
|
1475 | basename: string;
|
1476 | dirname: string;
|
1477 | path: string;
|
1478 | error: any;
|
1479 | }
|
1480 | export interface CompilerSystemWriteFileResults {
|
1481 | path: string;
|
1482 | error: any;
|
1483 | }
|
1484 | export interface Credentials {
|
1485 | key: string;
|
1486 | cert: string;
|
1487 | }
|
1488 | export interface ConfigBundle {
|
1489 | components: string[];
|
1490 | }
|
1491 | /**
|
1492 | * A file and/or directory copy operation that may be specified as part of
|
1493 | * certain output targets for Stencil (in particular `dist`,
|
1494 | * `dist-custom-elements`, and `www`).
|
1495 | */
|
1496 | export interface CopyTask {
|
1497 | /**
|
1498 | * The source file path for a copy operation. This may be an absolute or
|
1499 | * relative path to a directory or a file, and may also include a glob
|
1500 | * pattern.
|
1501 | *
|
1502 | * If the path is a relative path it will be treated as relative to
|
1503 | * `Config.srcDir`.
|
1504 | */
|
1505 | src: string;
|
1506 | /**
|
1507 | * An optional destination file path for a copy operation. This may be an
|
1508 | * absolute or relative path.
|
1509 | *
|
1510 | * If relative, this will be treated as relative to the output directory for
|
1511 | * the output target for which this copy operation is configured.
|
1512 | */
|
1513 | dest?: string;
|
1514 | /**
|
1515 | * An optional array of glob patterns to exclude from the copy operation.
|
1516 | * @default ['**\/__mocks__/**', '**\/__fixtures__/**', '**\/dist/**', '**\/.{idea,git,cache,output,temp}/**', '**\/.ds_store', '**\/.gitignore', '**\/desktop.ini', '**\/thumbs.db']
|
1517 | */
|
1518 | ignore?: string[];
|
1519 | /**
|
1520 | * Whether or not Stencil should issue warnings if it cannot find the
|
1521 | * specified source files or directories. Defaults to `false`.
|
1522 | *
|
1523 | * To receive warnings if a copy task source can't be found set this to
|
1524 | * `true`.
|
1525 | */
|
1526 | warn?: boolean;
|
1527 | /**
|
1528 | * Whether or not directory structure should be preserved when copying files
|
1529 | * from a source directory. Defaults to `true` if no `dest` path is supplied,
|
1530 | * else it defaults to `false`.
|
1531 | *
|
1532 | * If this is set to `false`, all the files from a source directory will be
|
1533 | * copied directly to the destination directory, but if it's set to `true` they
|
1534 | * will be copied to a new directory inside the destination directory with
|
1535 | * the same name as their original source directory.
|
1536 | *
|
1537 | * So if, for instance, `src` is set to `"images"` and `keepDirStructure` is
|
1538 | * set to `true` the copy task will then produce the following directory
|
1539 | * structure:
|
1540 | *
|
1541 | * ```
|
1542 | * images
|
1543 | * └── foo.png
|
1544 | * dist
|
1545 | * └── images
|
1546 | * └── foo.png
|
1547 | * ```
|
1548 | *
|
1549 | * Conversely if `keepDirStructure` is set to `false` then files in `images/`
|
1550 | * will be copied to `dist` without first creating a new subdirectory,
|
1551 | * resulting in the following directory structure:
|
1552 | *
|
1553 | * ```
|
1554 | * images
|
1555 | * └── foo.png
|
1556 | * dist
|
1557 | * └── foo.png
|
1558 | * ```
|
1559 | *
|
1560 | * If a `dest` path is supplied then `keepDirStructure`
|
1561 | * will default to `false`, so that Stencil will write the
|
1562 | * copied files directly into the `dest` directory without creating a new
|
1563 | * subdirectory. This behavior can be overridden by setting
|
1564 | * `keepDirStructure` to `true`.
|
1565 | */
|
1566 | keepDirStructure?: boolean;
|
1567 | }
|
1568 | /**
|
1569 | * Configuration for generating documentation from Stencil components.
|
1570 | */
|
1571 | export interface StencilDocsConfig {
|
1572 | /**
|
1573 | * Options for processing and rendering Markdown documentation files.
|
1574 | */
|
1575 | markdown?: {
|
1576 | /**
|
1577 | * Styling for how the target component will be represented within documentation (e.g., in component diagrams).
|
1578 | */
|
1579 | targetComponent?: {
|
1580 | /**
|
1581 | * Background color used for nodes representing the component in diagrams (e.g., Mermaid graphs).
|
1582 | * Use standard color names or hex codes.
|
1583 | * @example '#f0f0f0' (light gray)
|
1584 | */
|
1585 | background?: string;
|
1586 | /**
|
1587 | * Text color used within nodes representing the component in diagrams (e.g., Mermaid graphs).
|
1588 | * Use standard color names or hex codes.
|
1589 | * @example '#333' (dark gray)
|
1590 | */
|
1591 | textColor?: string;
|
1592 | };
|
1593 | };
|
1594 | }
|
1595 | export interface BundlingConfig {
|
1596 | /**
|
1597 | * @deprecated the `namedExports` field is no longer honored by `@rollup/plugin-commonjs` and is not used by Stencil.
|
1598 | * This field can be safely removed from your Stencil configuration file.
|
1599 | */
|
1600 | namedExports?: {
|
1601 | [key: string]: string[];
|
1602 | };
|
1603 | }
|
1604 | export interface NodeResolveConfig {
|
1605 | module?: boolean;
|
1606 | jsnext?: boolean;
|
1607 | main?: boolean;
|
1608 | browser?: boolean;
|
1609 | extensions?: string[];
|
1610 | preferBuiltins?: boolean;
|
1611 | jail?: string;
|
1612 | only?: Array<string | RegExp>;
|
1613 | modulesOnly?: boolean;
|
1614 | /**
|
1615 | * @see https://github.com/browserify/resolve#resolveid-opts-cb
|
1616 | * @deprecated the `customResolveOptions` field is no longer honored in future versions of
|
1617 | * `@rollup/plugin-node-resolve`. If you are currently using it, please open a new issue in the Stencil repo to
|
1618 | * describe your use case & provide input (https://github.com/ionic-team/stencil/issues/new/choose)
|
1619 | */
|
1620 | customResolveOptions?: {
|
1621 | basedir?: string;
|
1622 | package?: string;
|
1623 | extensions?: string[];
|
1624 | readFile?: Function;
|
1625 | isFile?: Function;
|
1626 | isDirectory?: Function;
|
1627 | packageFilter?: Function;
|
1628 | pathFilter?: Function;
|
1629 | paths?: Function | string[];
|
1630 | moduleDirectory?: string | string[];
|
1631 | preserveSymlinks?: boolean;
|
1632 | };
|
1633 | }
|
1634 | export interface RollupConfig {
|
1635 | inputOptions?: RollupInputOptions;
|
1636 | outputOptions?: RollupOutputOptions;
|
1637 | }
|
1638 | export interface RollupInputOptions {
|
1639 | context?: string;
|
1640 | moduleContext?: ((id: string) => string) | {
|
1641 | [id: string]: string;
|
1642 | };
|
1643 | treeshake?: boolean;
|
1644 | external?: (string | RegExp)[] | string | RegExp | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | undefined);
|
1645 | }
|
1646 | export interface RollupOutputOptions {
|
1647 | globals?: {
|
1648 | [name: string]: string;
|
1649 | } | ((name: string) => string);
|
1650 | }
|
1651 | export interface Testing {
|
1652 | run(opts: TestingRunOptions): Promise<boolean>;
|
1653 | destroy(): Promise<void>;
|
1654 | }
|
1655 | export declare type Path = string;
|
1656 | export declare type TransformerConfig = [string, Record<string, unknown>];
|
1657 | /**
|
1658 | * Options for initiating a run of Stencil tests (spec and/or end-to-end)
|
1659 | */
|
1660 | export interface TestingRunOptions {
|
1661 | /**
|
1662 | * If true, run end-to-end tests
|
1663 | */
|
1664 | e2e?: boolean;
|
1665 | /**
|
1666 | * If true, run screenshot tests
|
1667 | */
|
1668 | screenshot?: boolean;
|
1669 | /**
|
1670 | * If true, run spec tests
|
1671 | */
|
1672 | spec?: boolean;
|
1673 | /**
|
1674 | * If true, update 'golden' screenshots. Otherwise, compare against priori.
|
1675 | */
|
1676 | updateScreenshot?: boolean;
|
1677 | }
|
1678 | export interface JestConfig {
|
1679 | /**
|
1680 | * This option tells Jest that all imported modules in your tests should be mocked automatically.
|
1681 | * All modules used in your tests will have a replacement implementation, keeping the API surface. Default: false
|
1682 | */
|
1683 | automock?: boolean;
|
1684 | /**
|
1685 | * By default, Jest runs all tests and produces all errors into the console upon completion.
|
1686 | * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
|
1687 | */
|
1688 | bail?: boolean | number;
|
1689 | /**
|
1690 | * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
|
1691 | * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
|
1692 | * customize where Jest stores that cache data on disk. Default: "/tmp/<path>"
|
1693 | */
|
1694 | cacheDirectory?: string;
|
1695 | /**
|
1696 | * Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks()
|
1697 | * between each test. This does not remove any mock implementation that may have been provided. Default: false
|
1698 | */
|
1699 | clearMocks?: boolean;
|
1700 | /**
|
1701 | * Indicates whether the coverage information should be collected while executing the test. Because this retrofits all
|
1702 | * executed files with coverage collection statements, it may significantly slow down your tests. Default: false
|
1703 | */
|
1704 | collectCoverage?: boolean;
|
1705 | /**
|
1706 | * An array of glob patterns indicating a set of files for which coverage information should be collected.
|
1707 | * If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist
|
1708 | * for this file and it's never required in the test suite. Default: undefined
|
1709 | */
|
1710 | collectCoverageFrom?: any[];
|
1711 | /**
|
1712 | * The directory where Jest should output its coverage files. Default: undefined
|
1713 | */
|
1714 | coverageDirectory?: string;
|
1715 | /**
|
1716 | * An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches
|
1717 | * any of the patterns, coverage information will be skipped. These pattern strings match against the full path.
|
1718 | * Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally
|
1719 | * ignoring all of your files in different environments that may have different root directories.
|
1720 | * Example: ["<rootDir>/build/", "<rootDir>/node_modules/"]. Default: ["/node_modules/"]
|
1721 | */
|
1722 | coveragePathIgnorePatterns?: any[];
|
1723 | /**
|
1724 | * A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.
|
1725 | * Default: `["json", "lcov", "text"]`
|
1726 | */
|
1727 | coverageReporters?: any[];
|
1728 | /**
|
1729 | * This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global,
|
1730 | * as a glob, and as a directory or file path. If thresholds aren't met, jest will fail. Thresholds specified as a positive
|
1731 | * number are taken to be the minimum percentage required. Thresholds specified as a negative number represent the maximum
|
1732 | * number of uncovered entities allowed. Default: undefined
|
1733 | */
|
1734 | coverageThreshold?: any;
|
1735 | errorOnDeprecated?: boolean;
|
1736 | forceCoverageMatch?: any[];
|
1737 | globals?: any;
|
1738 | globalSetup?: string;
|
1739 | globalTeardown?: string;
|
1740 | /**
|
1741 | * An array of directory names to be searched recursively up from the requiring module's location. Setting this option will
|
1742 | * override the default, if you wish to still search node_modules for packages include it along with any other
|
1743 | * options: ["node_modules", "bower_components"]. Default: ["node_modules"]
|
1744 | */
|
1745 | moduleDirectories?: string[];
|
1746 | /**
|
1747 | * An array of file extensions your modules use. If you require modules without specifying a file extension,
|
1748 | * these are the extensions Jest will look for. Default: ['ts', 'tsx', 'js', 'json']
|
1749 | */
|
1750 | moduleFileExtensions?: string[];
|
1751 | moduleNameMapper?: any;
|
1752 | modulePaths?: any[];
|
1753 | modulePathIgnorePatterns?: any[];
|
1754 | notify?: boolean;
|
1755 | notifyMode?: string;
|
1756 | preset?: string;
|
1757 | prettierPath?: string;
|
1758 | projects?: any;
|
1759 | reporters?: any;
|
1760 | resetMocks?: boolean;
|
1761 | resetModules?: boolean;
|
1762 | resolver?: Path | null;
|
1763 | restoreMocks?: boolean;
|
1764 | rootDir?: string;
|
1765 | roots?: any[];
|
1766 | runner?: string;
|
1767 | /**
|
1768 | * The paths to modules that run some code to configure or set up the testing environment before each test.
|
1769 | * Since every test runs in its own environment, these scripts will be executed in the testing environment
|
1770 | * immediately before executing the test code itself. Default: []
|
1771 | */
|
1772 | setupFiles?: string[];
|
1773 | setupFilesAfterEnv?: string[];
|
1774 | snapshotSerializers?: any[];
|
1775 | testEnvironment?: string;
|
1776 | testEnvironmentOptions?: any;
|
1777 | testMatch?: string[];
|
1778 | testPathIgnorePatterns?: string[];
|
1779 | testPreset?: string;
|
1780 | testRegex?: string[];
|
1781 | testResultsProcessor?: string;
|
1782 | testRunner?: string;
|
1783 | testURL?: string;
|
1784 | timers?: string;
|
1785 | transform?: {
|
1786 | [regex: string]: Path | TransformerConfig;
|
1787 | };
|
1788 | transformIgnorePatterns?: any[];
|
1789 | unmockedModulePathPatterns?: any[];
|
1790 | verbose?: boolean;
|
1791 | watchPathIgnorePatterns?: any[];
|
1792 | }
|
1793 | export interface TestingConfig extends JestConfig {
|
1794 | /**
|
1795 | * The `allowableMismatchedPixels` value is used to determine an acceptable
|
1796 | * number of pixels that can be mismatched before the image is considered
|
1797 | * to have changes. Realistically, two screenshots representing the same
|
1798 | * content may have a small number of pixels that are not identical due to
|
1799 | * anti-aliasing, which is perfectly normal. If the `allowableMismatchedRatio`
|
1800 | * is provided it will take precedence, otherwise `allowableMismatchedPixels`
|
1801 | * will be used.
|
1802 | */
|
1803 | allowableMismatchedPixels?: number;
|
1804 | /**
|
1805 | * The `allowableMismatchedRatio` ranges from `0` to `1` and is used to
|
1806 | * determine an acceptable ratio of pixels that can be mismatched before
|
1807 | * the image is considered to have changes. Realistically, two screenshots
|
1808 | * representing the same content may have a small number of pixels that
|
1809 | * are not identical due to anti-aliasing, which is perfectly normal. The
|
1810 | * `allowableMismatchedRatio` is the number of pixels that were mismatched,
|
1811 | * divided by the total number of pixels in the screenshot. For example,
|
1812 | * a ratio value of `0.06` means 6% of the pixels can be mismatched before
|
1813 | * the image is considered to have changes. If the `allowableMismatchedRatio`
|
1814 | * is provided it will take precedence, otherwise `allowableMismatchedPixels`
|
1815 | * will be used.
|
1816 | */
|
1817 | allowableMismatchedRatio?: number;
|
1818 | /**
|
1819 | * Matching threshold while comparing two screenshots. Value ranges from `0` to `1`.
|
1820 | * Smaller values make the comparison more sensitive. The `pixelmatchThreshold`
|
1821 | * value helps to ignore anti-aliasing. Default: `0.1`
|
1822 | */
|
1823 | pixelmatchThreshold?: number;
|
1824 | /**
|
1825 | * Additional arguments to pass to the browser instance.
|
1826 | */
|
1827 | browserArgs?: string[];
|
1828 | /**
|
1829 | * Path to a Chromium or Chrome executable to run instead of the bundled Chromium.
|
1830 | */
|
1831 | browserExecutablePath?: string;
|
1832 | /**
|
1833 | * Url of remote Chrome instance to use instead of local Chrome.
|
1834 | */
|
1835 | browserWSEndpoint?: string;
|
1836 | /**
|
1837 | * Whether to run browser e2e tests in headless mode.
|
1838 | *
|
1839 | * Starting with Chrome v112, a new headless mode was introduced.
|
1840 | * The new headless mode unifies the "headful" and "headless" code paths in the Chrome distributable.
|
1841 | *
|
1842 | * To enable the "new" headless mode, a string value of "new" must be provided.
|
1843 | * To use the "old" headless mode, a boolean value of `true` must be provided.
|
1844 | * To use "headful" mode, a boolean value of `false` must be provided.
|
1845 | *
|
1846 | * Defaults to true.
|
1847 | */
|
1848 | browserHeadless?: boolean | 'new';
|
1849 | /**
|
1850 | * Slows down e2e browser operations by the specified amount of milliseconds.
|
1851 | * Useful so that you can see what is going on.
|
1852 | */
|
1853 | browserSlowMo?: number;
|
1854 | /**
|
1855 | * By default, all E2E pages wait until the "load" event, this global setting can be used
|
1856 | * to change the default `waitUntil` behavior.
|
1857 | */
|
1858 | browserWaitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
1859 | /**
|
1860 | * Whether to auto-open a DevTools panel for each tab.
|
1861 | * If this option is true, the headless option will be set false
|
1862 | */
|
1863 | browserDevtools?: boolean;
|
1864 | /**
|
1865 | * Array of browser emulations to be used during _screenshot_ tests. A full screenshot
|
1866 | * test is ran for each emulation.
|
1867 | *
|
1868 | * To emulate a device display for your e2e tests, use the `setViewport` method on a test's E2E page.
|
1869 | * An example can be found in [the Stencil docs](https://stenciljs.com/docs/end-to-end-testing#emulate-a-display).
|
1870 | */
|
1871 | emulate?: EmulateConfig[];
|
1872 | /**
|
1873 | * Path to the Screenshot Connector module.
|
1874 | */
|
1875 | screenshotConnector?: string;
|
1876 | /**
|
1877 | * Timeout for the pixelmatch worker to resolve (in ms).
|
1878 | * @default 2500
|
1879 | */
|
1880 | screenshotTimeout?: number | null;
|
1881 | /**
|
1882 | * Amount of time in milliseconds to wait before a screenshot is taken.
|
1883 | */
|
1884 | waitBeforeScreenshot?: number;
|
1885 | }
|
1886 | export interface EmulateConfig {
|
1887 | /**
|
1888 | * Predefined device descriptor name, such as "iPhone X" or "Nexus 10".
|
1889 | * For a complete list please see: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
|
1890 | */
|
1891 | device?: string;
|
1892 | /**
|
1893 | * User-Agent to be used. Defaults to the user-agent of the installed Puppeteer version.
|
1894 | */
|
1895 | userAgent?: string;
|
1896 | viewport?: EmulateViewport;
|
1897 | }
|
1898 | export interface EmulateViewport {
|
1899 | /**
|
1900 | * Page width in pixels.
|
1901 | */
|
1902 | width: number;
|
1903 | /**
|
1904 | * page height in pixels.
|
1905 | */
|
1906 | height: number;
|
1907 | /**
|
1908 | * Specify device scale factor (can be thought of as dpr). Defaults to 1.
|
1909 | */
|
1910 | deviceScaleFactor?: number;
|
1911 | /**
|
1912 | * Whether the meta viewport tag is taken into account. Defaults to false.
|
1913 | */
|
1914 | isMobile?: boolean;
|
1915 | /**
|
1916 | * Specifies if viewport supports touch events. Defaults to false
|
1917 | */
|
1918 | hasTouch?: boolean;
|
1919 | /**
|
1920 | * Specifies if viewport is in landscape mode. Defaults to false.
|
1921 | */
|
1922 | isLandscape?: boolean;
|
1923 | }
|
1924 | /**
|
1925 | * This sets the log level hierarchy for our terminal logger, ranging from
|
1926 | * most to least verbose.
|
1927 | *
|
1928 | * Ordering the levels like this lets us easily check whether we should log a
|
1929 | * message at a given time. For instance, if the log level is set to `'warn'`,
|
1930 | * then anything passed to the logger with level `'warn'` or `'error'` should
|
1931 | * be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
|
1932 | *
|
1933 | * If we have a current log level `currentLevel` and a message with level
|
1934 | * `msgLevel` is passed to the logger, we can determine whether or not we should
|
1935 | * log it by checking if the log level on the message is further up or at the
|
1936 | * same level in the hierarchy than `currentLevel`, like so:
|
1937 | *
|
1938 | * ```ts
|
1939 | * LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
|
1940 | * ```
|
1941 | *
|
1942 | * NOTE: for the reasons described above, do not change the order of the entries
|
1943 | * in this array without good reason!
|
1944 | */
|
1945 | export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
1946 | export type LogLevel = (typeof LOG_LEVELS)[number];
|
1947 | /**
|
1948 | * Abstract interface representing a logger with the capability to accept log
|
1949 | * messages at various levels (debug, info, warn, and error), set colors, log
|
1950 | * time spans, print diagnostic messages, and more.
|
1951 | *
|
1952 | * A Node.js-specific implementation of this interface is used when Stencil is
|
1953 | * building and compiling a project.
|
1954 | */
|
1955 | export interface Logger {
|
1956 | enableColors: (useColors: boolean) => void;
|
1957 | setLevel: (level: LogLevel) => void;
|
1958 | getLevel: () => LogLevel;
|
1959 | debug: (...msg: any[]) => void;
|
1960 | info: (...msg: any[]) => void;
|
1961 | warn: (...msg: any[]) => void;
|
1962 | error: (...msg: any[]) => void;
|
1963 | createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
|
1964 | printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
|
1965 | red: (msg: string) => string;
|
1966 | green: (msg: string) => string;
|
1967 | yellow: (msg: string) => string;
|
1968 | blue: (msg: string) => string;
|
1969 | magenta: (msg: string) => string;
|
1970 | cyan: (msg: string) => string;
|
1971 | gray: (msg: string) => string;
|
1972 | bold: (msg: string) => string;
|
1973 | dim: (msg: string) => string;
|
1974 | bgRed: (msg: string) => string;
|
1975 | emoji: (e: string) => string;
|
1976 | setLogFilePath?: (p: string) => void;
|
1977 | writeLogs?: (append: boolean) => void;
|
1978 | createLineUpdater?: () => Promise<LoggerLineUpdater>;
|
1979 | }
|
1980 | export interface LoggerLineUpdater {
|
1981 | update(text: string): Promise<void>;
|
1982 | stop(): Promise<void>;
|
1983 | }
|
1984 | export interface LoggerTimeSpan {
|
1985 | duration(): number;
|
1986 | finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
|
1987 | }
|
1988 | export interface OutputTargetDist extends OutputTargetValidationConfig {
|
1989 | type: 'dist';
|
1990 | buildDir?: string;
|
1991 | collectionDir?: string | null;
|
1992 | /**
|
1993 | * When `true` this flag will transform aliased import paths defined in
|
1994 | * a project's `tsconfig.json` to relative import paths in the compiled output's
|
1995 | * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
|
1996 | *
|
1997 | * Paths will be left in aliased format if `false`.
|
1998 | *
|
1999 | * @example
|
2000 | * // tsconfig.json
|
2001 | * {
|
2002 | * paths: {
|
2003 | * "@utils/*": ['/src/utils/*']
|
2004 | * }
|
2005 | * }
|
2006 | *
|
2007 | * // Source file
|
2008 | * import * as dateUtils from '@utils/date-utils';
|
2009 | * // Output file
|
2010 | * import * as dateUtils from '../utils/date-utils';
|
2011 | */
|
2012 | transformAliasedImportPathsInCollection?: boolean | null;
|
2013 | typesDir?: string;
|
2014 | /**
|
2015 | * Provide a custom path for the ESM loader directory, containing files you can import
|
2016 | * in an initiation script within your application to register all your components for
|
2017 | * lazy loading.
|
2018 | *
|
2019 | * @default /dist/loader
|
2020 | */
|
2021 | esmLoaderPath?: string;
|
2022 | copy?: CopyTask[];
|
2023 | polyfills?: boolean;
|
2024 | empty?: boolean;
|
2025 | }
|
2026 | export interface OutputTargetDistCollection extends OutputTargetValidationConfig {
|
2027 | type: 'dist-collection';
|
2028 | empty?: boolean;
|
2029 | dir: string;
|
2030 | collectionDir: string;
|
2031 | /**
|
2032 | * When `true` this flag will transform aliased import paths defined in
|
2033 | * a project's `tsconfig.json` to relative import paths in the compiled output.
|
2034 | *
|
2035 | * Paths will be left in aliased format if `false` or `undefined`.
|
2036 | *
|
2037 | * @example
|
2038 | * // tsconfig.json
|
2039 | * {
|
2040 | * paths: {
|
2041 | * "@utils/*": ['/src/utils/*']
|
2042 | * }
|
2043 | * }
|
2044 | *
|
2045 | * // Source file
|
2046 | * import * as dateUtils from '@utils/date-utils';
|
2047 | * // Output file
|
2048 | * import * as dateUtils from '../utils/date-utils';
|
2049 | */
|
2050 | transformAliasedImportPaths?: boolean | null;
|
2051 | }
|
2052 | export interface OutputTargetDistTypes extends OutputTargetValidationConfig {
|
2053 | type: 'dist-types';
|
2054 | dir: string;
|
2055 | typesDir: string;
|
2056 | }
|
2057 | export interface OutputTargetDistLazy extends OutputTargetBase {
|
2058 | type: 'dist-lazy';
|
2059 | dir?: string;
|
2060 | esmDir?: string;
|
2061 | esmEs5Dir?: string;
|
2062 | systemDir?: string;
|
2063 | cjsDir?: string;
|
2064 | polyfills?: boolean;
|
2065 | isBrowserBuild?: boolean;
|
2066 | esmIndexFile?: string;
|
2067 | cjsIndexFile?: string;
|
2068 | systemLoaderFile?: string;
|
2069 | legacyLoaderFile?: string;
|
2070 | empty?: boolean;
|
2071 | }
|
2072 | export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
|
2073 | type: 'dist-global-styles';
|
2074 | file: string;
|
2075 | }
|
2076 | export interface OutputTargetDistLazyLoader extends OutputTargetBase {
|
2077 | type: 'dist-lazy-loader';
|
2078 | dir: string;
|
2079 | esmDir: string;
|
2080 | esmEs5Dir?: string;
|
2081 | cjsDir: string;
|
2082 | componentDts: string;
|
2083 | empty: boolean;
|
2084 | }
|
2085 | export interface OutputTargetHydrate extends OutputTargetBase {
|
2086 | type: 'dist-hydrate-script';
|
2087 | dir?: string;
|
2088 | /**
|
2089 | * Module IDs that should not be bundled into the script.
|
2090 | * By default, all node builtin's, such as `fs` or `path`
|
2091 | * will be considered "external" and not bundled.
|
2092 | */
|
2093 | external?: string[];
|
2094 | empty?: boolean;
|
2095 | }
|
2096 | export interface OutputTargetCustom extends OutputTargetBase {
|
2097 | type: 'custom';
|
2098 | name: string;
|
2099 | /**
|
2100 | * Indicate when the output target should be executed.
|
2101 | *
|
2102 | * - `"onBuildOnly"`: Executed only when `stencil build` is called without `--watch`.
|
2103 | * - `"always"`: Executed on every build, including in `watch` mode.
|
2104 | *
|
2105 | * Defaults to "always".
|
2106 | */
|
2107 | taskShouldRun?: 'onBuildOnly' | 'always';
|
2108 | validate?: (config: Config, diagnostics: Diagnostic[]) => void;
|
2109 | generator: (config: Config, compilerCtx: CompilerCtx, buildCtx: BuildCtx, docs: JsonDocs) => Promise<void>;
|
2110 | copy?: CopyTask[];
|
2111 | }
|
2112 | /**
|
2113 | * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
|
2114 | * file.
|
2115 | */
|
2116 | export interface OutputTargetDocsVscode extends OutputTargetBase {
|
2117 | /**
|
2118 | * Designates this output target to be used for generating VS Code custom data.
|
2119 | * @see OutputTargetBase#type
|
2120 | */
|
2121 | type: 'docs-vscode';
|
2122 | /**
|
2123 | * The location on disk to write the JSON file.
|
2124 | */
|
2125 | file: string;
|
2126 | /**
|
2127 | * A base URL to find the source code of the component(s) described in the JSON file.
|
2128 | */
|
2129 | sourceCodeBaseUrl?: string;
|
2130 | }
|
2131 | export interface OutputTargetDocsReadme extends OutputTargetBase {
|
2132 | type: 'docs-readme';
|
2133 | /**
|
2134 | * The root directory where README files should be written
|
2135 | *
|
2136 | * defaults to {@link Config.srcDir}
|
2137 | */
|
2138 | dir?: string;
|
2139 | dependencies?: boolean;
|
2140 | footer?: string;
|
2141 | strict?: boolean;
|
2142 | }
|
2143 | export interface OutputTargetDocsJson extends OutputTargetBase {
|
2144 | type: 'docs-json';
|
2145 | file: string;
|
2146 | /**
|
2147 | * Set an optional file path where Stencil should write a `d.ts` file to disk
|
2148 | * at build-time containing type declarations for {@link JsonDocs} and related
|
2149 | * interfaces. If this is omitted or set to `null` Stencil will not write such
|
2150 | * a file.
|
2151 | */
|
2152 | typesFile?: string | null;
|
2153 | strict?: boolean;
|
2154 | /**
|
2155 | * An optional file path pointing to a public type library which should be
|
2156 | * included and documented in the same way as other types which are included
|
2157 | * in this output target.
|
2158 | *
|
2159 | * This could be useful if, for instance, there are some important interfaces
|
2160 | * used in a few places in a Stencil project which don't form part of the
|
2161 | * public API for any of the project's components. Such interfaces will not
|
2162 | * be included in the `docs-json` output by default, but if they're declared
|
2163 | * and exported from a 'supplemental' file designated with this property then
|
2164 | * they'll be included in the output, facilitating their documentation.
|
2165 | */
|
2166 | supplementalPublicTypes?: string;
|
2167 | }
|
2168 | export interface OutputTargetDocsCustom extends OutputTargetBase {
|
2169 | type: 'docs-custom';
|
2170 | generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
|
2171 | strict?: boolean;
|
2172 | }
|
2173 | export interface OutputTargetStats extends OutputTargetBase {
|
2174 | type: 'stats';
|
2175 | file?: string;
|
2176 | }
|
2177 | export interface OutputTargetBaseNext {
|
2178 | type: string;
|
2179 | dir?: string;
|
2180 | }
|
2181 | /**
|
2182 | * The collection of valid export behaviors.
|
2183 | * Used to generate a type for typed configs as well as output target validation
|
2184 | * for the `dist-custom-elements` output target.
|
2185 | *
|
2186 | * Adding a value to this const array will automatically add it as a valid option on the
|
2187 | * output target configuration for `customElementsExportBehavior`.
|
2188 | *
|
2189 | * - `default`: No additional export or definition behavior will happen.
|
2190 | * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
|
2191 | * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
|
2192 | * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
|
2193 | * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
|
2194 | * from `dist-custom-elements-bundle` to `dist-custom-elements`.
|
2195 | * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
|
2196 | */
|
2197 | export declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
|
2198 | /**
|
2199 | * This type is auto-generated based on the values in `CustomElementsExportBehaviorOptions` array.
|
2200 | * This is used on the output target config for intellisense in typed configs.
|
2201 | */
|
2202 | export type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
|
2203 | export interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
|
2204 | type: 'dist-custom-elements';
|
2205 | empty?: boolean;
|
2206 | /**
|
2207 | * Triggers the following behaviors when enabled:
|
2208 | * 1. All `@stencil/core/*` module references are treated as external during bundling.
|
2209 | * 2. File names are not hashed.
|
2210 | * 3. File minification will follow the behavior defined at the root of the Stencil config.
|
2211 | */
|
2212 | externalRuntime?: boolean;
|
2213 | copy?: CopyTask[];
|
2214 | includeGlobalScripts?: boolean;
|
2215 | minify?: boolean;
|
2216 | /**
|
2217 | * Enables the generation of type definition files for the output target.
|
2218 | */
|
2219 | generateTypeDeclarations?: boolean;
|
2220 | /**
|
2221 | * Define the export/definition behavior for the output target's generated output.
|
2222 | * This controls if/how custom elements will be defined or where components will be exported from.
|
2223 | * If omitted, no auto-definition behavior or re-exporting will happen.
|
2224 | */
|
2225 | customElementsExportBehavior?: CustomElementsExportBehavior;
|
2226 | }
|
2227 | /**
|
2228 | * The base type for output targets. All output targets should extend this base type.
|
2229 | */
|
2230 | export interface OutputTargetBase {
|
2231 | /**
|
2232 | * A unique string to differentiate one output target from another
|
2233 | */
|
2234 | type: string;
|
2235 | }
|
2236 | /**
|
2237 | * Output targets that can have validation for common `package.json` field values
|
2238 | * (module, types, etc.). This allows them to be marked for validation in a project's Stencil config.
|
2239 | */
|
2240 | interface OutputTargetValidationConfig extends OutputTargetBaseNext {
|
2241 | isPrimaryPackageOutputTarget?: boolean;
|
2242 | }
|
2243 | export type EligiblePrimaryPackageOutputTarget = OutputTargetDist | OutputTargetDistCustomElements | OutputTargetDistCollection | OutputTargetDistTypes;
|
2244 | export type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
|
2245 | export interface OutputTargetCopy extends OutputTargetBase {
|
2246 | type: 'copy';
|
2247 | dir: string;
|
2248 | copy?: CopyTask[];
|
2249 | copyAssets?: 'collection' | 'dist';
|
2250 | }
|
2251 | export interface OutputTargetWww extends OutputTargetBase {
|
2252 | /**
|
2253 | * Webapp output target.
|
2254 | */
|
2255 | type: 'www';
|
2256 | /**
|
2257 | * The directory to write the app's JavaScript and CSS build
|
2258 | * files to. The default is to place this directory as a child
|
2259 | * to the `dir` config. Default: `build`
|
2260 | */
|
2261 | buildDir?: string;
|
2262 | /**
|
2263 | * The directory to write the entire application to.
|
2264 | * Note, the `buildDir` is where the app's JavaScript and CSS build
|
2265 | * files are written. Default: `www`
|
2266 | */
|
2267 | dir?: string;
|
2268 | /**
|
2269 | * Empty the build directory of all files and directories on first build.
|
2270 | * Default: `true`
|
2271 | */
|
2272 | empty?: boolean;
|
2273 | /**
|
2274 | * The default index html file of the app, commonly found at the
|
2275 | * root of the `src` directory.
|
2276 | * Default: `index.html`
|
2277 | */
|
2278 | indexHtml?: string;
|
2279 | /**
|
2280 | * The copy config is an array of objects that defines any files or folders that should
|
2281 | * be copied over to the build directory.
|
2282 | *
|
2283 | * Each object in the array must include a src property which can be either an absolute path,
|
2284 | * a relative path or a glob pattern. The config can also provide an optional dest property
|
2285 | * which can be either an absolute path or a path relative to the build directory.
|
2286 | * Also note that any files within src/assets are automatically copied to www/assets for convenience.
|
2287 | *
|
2288 | * In the copy config below, it will copy the entire directory from src/docs-content over to www/docs-content.
|
2289 | */
|
2290 | copy?: CopyTask[];
|
2291 | /**
|
2292 | * The base url of the app, it's required during prerendering to be the absolute path
|
2293 | * of your app, such as: `https://my.app.com/app`.
|
2294 | *
|
2295 | * Default: `/`
|
2296 | */
|
2297 | baseUrl?: string;
|
2298 | /**
|
2299 | * By default, stencil will include all the polyfills required by legacy browsers in the ES5 build.
|
2300 | * If it's `false`, stencil will not emit this polyfills anymore and it's your responsibility to provide them before
|
2301 | * stencil initializes.
|
2302 | */
|
2303 | polyfills?: boolean;
|
2304 | /**
|
2305 | * Path to an external node module which has exports of the prerender config object.
|
2306 | * ```
|
2307 | * module.exports = {
|
2308 | * afterHydrate(document, url) {
|
2309 | * document.title = `URL: ${url.href}`;
|
2310 | * }
|
2311 | * }
|
2312 | * ```
|
2313 | */
|
2314 | prerenderConfig?: string;
|
2315 | /**
|
2316 | * Service worker config for production builds. During development builds
|
2317 | * service worker script will be injected to automatically deregister existing
|
2318 | * service workers. When set to `false` neither a service worker registration
|
2319 | * or deregistration will be added to the index.html.
|
2320 | */
|
2321 | serviceWorker?: ServiceWorkerConfig | null | false;
|
2322 | appDir?: string;
|
2323 | }
|
2324 | export type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
|
2325 | /**
|
2326 | * Our custom configuration interface for generated caching Service Workers
|
2327 | * using the Workbox library (see https://developer.chrome.com/docs/workbox/).
|
2328 | *
|
2329 | * Although we are using Workbox we are unfortunately unable to depend on the
|
2330 | * published types for the library because they must be compiled using the
|
2331 | * `webworker` lib for TypeScript, which cannot be used at the same time as
|
2332 | * the `dom` lib. So as a workaround we maintain our own interface here. See
|
2333 | * here to refer to the published version:
|
2334 | * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c7b4dadae5b320ad1311a8f82242b8f2f41b7b8c/types/workbox-build/generate-sw.d.ts#L3
|
2335 | */
|
2336 | export interface ServiceWorkerConfig {
|
2337 | unregister?: boolean;
|
2338 | swDest?: string;
|
2339 | swSrc?: string;
|
2340 | globPatterns?: string[];
|
2341 | globDirectory?: string | string[];
|
2342 | globIgnores?: string | string[];
|
2343 | templatedUrls?: any;
|
2344 | maximumFileSizeToCacheInBytes?: number;
|
2345 | manifestTransforms?: any;
|
2346 | modifyUrlPrefix?: any;
|
2347 | dontCacheBustURLsMatching?: RegExp;
|
2348 | navigateFallback?: string;
|
2349 | navigateFallbackWhitelist?: RegExp[];
|
2350 | navigateFallbackBlacklist?: RegExp[];
|
2351 | cacheId?: string;
|
2352 | skipWaiting?: boolean;
|
2353 | clientsClaim?: boolean;
|
2354 | directoryIndex?: string;
|
2355 | runtimeCaching?: any[];
|
2356 | ignoreUrlParametersMatching?: any[];
|
2357 | handleFetch?: boolean;
|
2358 | }
|
2359 | export interface LoadConfigInit {
|
2360 | /**
|
2361 | * User config object to merge into default config and
|
2362 | * config loaded from a file path.
|
2363 | */
|
2364 | config?: UnvalidatedConfig;
|
2365 | /**
|
2366 | * Absolute path to a Stencil config file. This path cannot be
|
2367 | * relative and it does not resolve config files within a directory.
|
2368 | */
|
2369 | configPath?: string;
|
2370 | logger?: Logger;
|
2371 | sys?: CompilerSystem;
|
2372 | /**
|
2373 | * When set to true, if the "tsconfig.json" file is not found
|
2374 | * it'll automatically generate and save a default tsconfig
|
2375 | * within the root directory.
|
2376 | */
|
2377 | initTsConfig?: boolean;
|
2378 | }
|
2379 | /**
|
2380 | * Results from an attempt to load a config. The values on this interface
|
2381 | * have not yet been validated and are not ready to be used for arbitrary
|
2382 | * operations around the codebase.
|
2383 | */
|
2384 | export interface LoadConfigResults {
|
2385 | config: ValidatedConfig;
|
2386 | diagnostics: Diagnostic[];
|
2387 | tsconfig: {
|
2388 | path: string;
|
2389 | compilerOptions: any;
|
2390 | files: string[];
|
2391 | include: string[];
|
2392 | exclude: string[];
|
2393 | extends: string;
|
2394 | };
|
2395 | }
|
2396 | export interface Diagnostic {
|
2397 | absFilePath?: string | undefined;
|
2398 | code?: string;
|
2399 | columnNumber?: number | undefined;
|
2400 | debugText?: string;
|
2401 | header?: string;
|
2402 | language?: string;
|
2403 | level: 'error' | 'warn' | 'info' | 'log' | 'debug';
|
2404 | lineNumber?: number | undefined;
|
2405 | lines: PrintLine[];
|
2406 | messageText: string;
|
2407 | relFilePath?: string | undefined;
|
2408 | type: string;
|
2409 | }
|
2410 | export interface CacheStorage {
|
2411 | get(key: string): Promise<any>;
|
2412 | set(key: string, value: any): Promise<void>;
|
2413 | }
|
2414 | export interface WorkerOptions {
|
2415 | maxConcurrentWorkers?: number;
|
2416 | maxConcurrentTasksPerWorker?: number;
|
2417 | logger?: Logger;
|
2418 | }
|
2419 | export interface RollupInterface {
|
2420 | rollup: {
|
2421 | (config: any): Promise<any>;
|
2422 | };
|
2423 | plugins: {
|
2424 | nodeResolve(opts: any): any;
|
2425 | replace(opts: any): any;
|
2426 | commonjs(opts: any): any;
|
2427 | json(): any;
|
2428 | };
|
2429 | }
|
2430 | export interface ResolveModuleOptions {
|
2431 | manuallyResolve?: boolean;
|
2432 | packageJson?: boolean;
|
2433 | }
|
2434 | export interface PrerenderStartOptions {
|
2435 | buildId?: string;
|
2436 | hydrateAppFilePath?: string;
|
2437 | componentGraph?: BuildResultsComponentGraph;
|
2438 | srcIndexHtmlPath?: string;
|
2439 | }
|
2440 | export interface PrerenderResults {
|
2441 | buildId: string;
|
2442 | diagnostics: Diagnostic[];
|
2443 | urls: number;
|
2444 | duration: number;
|
2445 | average: number;
|
2446 | }
|
2447 | /**
|
2448 | * Input for CSS optimization functions, including the input CSS
|
2449 | * string and a few boolean options which turn on or off various
|
2450 | * optimizations.
|
2451 | */
|
2452 | export interface OptimizeCssInput {
|
2453 | input: string;
|
2454 | filePath?: string;
|
2455 | autoprefixer?: boolean | null | AutoprefixerOptions;
|
2456 | minify?: boolean;
|
2457 | sourceMap?: boolean;
|
2458 | resolveUrl?: (url: string) => Promise<string> | string;
|
2459 | }
|
2460 | /**
|
2461 | * This is not a real interface describing the options which can
|
2462 | * be passed to autoprefixer, for that see the docs, here:
|
2463 | * https://github.com/postcss/autoprefixer#options
|
2464 | *
|
2465 | * Instead, this basically just serves as a label type to track
|
2466 | * that arguments are being passed consistently.
|
2467 | */
|
2468 | export type AutoprefixerOptions = Object;
|
2469 | /**
|
2470 | * Output from CSS optimization functions, wrapping up optimized
|
2471 | * CSS and any diagnostics produced during optimization.
|
2472 | */
|
2473 | export interface OptimizeCssOutput {
|
2474 | output: string;
|
2475 | diagnostics: Diagnostic[];
|
2476 | }
|
2477 | export interface OptimizeJsInput {
|
2478 | input: string;
|
2479 | filePath?: string;
|
2480 | target?: 'es5' | 'latest';
|
2481 | pretty?: boolean;
|
2482 | sourceMap?: boolean;
|
2483 | }
|
2484 | export interface OptimizeJsOutput {
|
2485 | output: string;
|
2486 | sourceMap: any;
|
2487 | diagnostics: Diagnostic[];
|
2488 | }
|
2489 | export interface LazyRequire {
|
2490 | ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
|
2491 | require(fromDir: string, moduleId: string): any;
|
2492 | getModulePath(fromDir: string, moduleId: string): string;
|
2493 | }
|
2494 | /**
|
2495 | * @deprecated This interface is no longer used by Stencil
|
2496 | * TODO(STENCIL-743): Remove this interface
|
2497 | */
|
2498 | export interface FsWatcherItem {
|
2499 | close(): void;
|
2500 | }
|
2501 | /**
|
2502 | * @deprecated This interface is no longer used by Stencil
|
2503 | * TODO(STENCIL-743): Remove this interface
|
2504 | */
|
2505 | export interface MakeDirectoryOptions {
|
2506 | /**
|
2507 | * Indicates whether parent folders should be created.
|
2508 | * @default false
|
2509 | */
|
2510 | recursive?: boolean;
|
2511 | /**
|
2512 | * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
2513 | * @default 0o777.
|
2514 | */
|
2515 | mode?: number;
|
2516 | }
|
2517 | /**
|
2518 | * @deprecated This interface is no longer used by Stencil
|
2519 | * TODO(STENCIL-743): Remove this interface
|
2520 | */
|
2521 | export interface FsStats {
|
2522 | isFile(): boolean;
|
2523 | isDirectory(): boolean;
|
2524 | isBlockDevice(): boolean;
|
2525 | isCharacterDevice(): boolean;
|
2526 | isSymbolicLink(): boolean;
|
2527 | isFIFO(): boolean;
|
2528 | isSocket(): boolean;
|
2529 | dev: number;
|
2530 | ino: number;
|
2531 | mode: number;
|
2532 | nlink: number;
|
2533 | uid: number;
|
2534 | gid: number;
|
2535 | rdev: number;
|
2536 | size: number;
|
2537 | blksize: number;
|
2538 | blocks: number;
|
2539 | atime: Date;
|
2540 | mtime: Date;
|
2541 | ctime: Date;
|
2542 | birthtime: Date;
|
2543 | }
|
2544 | export interface Compiler {
|
2545 | build(): Promise<CompilerBuildResults>;
|
2546 | createWatcher(): Promise<CompilerWatcher>;
|
2547 | destroy(): Promise<void>;
|
2548 | sys: CompilerSystem;
|
2549 | }
|
2550 | export interface CompilerWatcher extends BuildOnEvents {
|
2551 | start: () => Promise<WatcherCloseResults>;
|
2552 | close: () => Promise<WatcherCloseResults>;
|
2553 | request: (data: CompilerRequest) => Promise<CompilerRequestResponse>;
|
2554 | }
|
2555 | export interface CompilerRequest {
|
2556 | path?: string;
|
2557 | }
|
2558 | export interface WatcherCloseResults {
|
2559 | exitCode: number;
|
2560 | }
|
2561 | export interface CompilerRequestResponse {
|
2562 | path: string;
|
2563 | nodeModuleId: string;
|
2564 | nodeModuleVersion: string;
|
2565 | nodeResolvedPath: string;
|
2566 | cachePath: string;
|
2567 | cacheHit: boolean;
|
2568 | content: string;
|
2569 | status: number;
|
2570 | }
|
2571 | /**
|
2572 | * Options for Stencil's string-to-string transpiler
|
2573 | */
|
2574 | export interface TranspileOptions {
|
2575 | /**
|
2576 | * A component can be defined as a custom element by using `customelement`, or the
|
2577 | * component class can be exported by using `module`. Default is `customelement`.
|
2578 | */
|
2579 | componentExport?: 'customelement' | 'module' | string | undefined;
|
2580 | /**
|
2581 | * Sets how and if component metadata should be assigned on the compiled
|
2582 | * component output. The `compilerstatic` value will set the metadata to
|
2583 | * a static `COMPILER_META` getter on the component class. This option
|
2584 | * is useful for unit testing preprocessors. Default is `null`.
|
2585 | */
|
2586 | componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
|
2587 | /**
|
2588 | * The actual internal import path for any `@stencil/core` imports.
|
2589 | * Default is `@stencil/core/internal/client`.
|
2590 | */
|
2591 | coreImportPath?: string;
|
2592 | /**
|
2593 | * The current working directory. Default is `/`.
|
2594 | */
|
2595 | currentDirectory?: string;
|
2596 | /**
|
2597 | * The filename of the code being compiled. Default is `module.tsx`.
|
2598 | */
|
2599 | file?: string;
|
2600 | /**
|
2601 | * Module format to use for the compiled code output, which can be either `esm` or `cjs`.
|
2602 | * Default is `esm`.
|
2603 | */
|
2604 | module?: 'cjs' | 'esm' | string;
|
2605 | /**
|
2606 | * Sets how and if any properties, methods and events are proxied on the
|
2607 | * component class. The `defineproperty` value sets the getters and setters
|
2608 | * using Object.defineProperty. Default is `defineproperty`.
|
2609 | */
|
2610 | proxy?: 'defineproperty' | string | undefined;
|
2611 | /**
|
2612 | * How component styles should be associated to the component. The `static`
|
2613 | * setting will assign the styles as a static getter on the component class.
|
2614 | */
|
2615 | style?: 'static' | string | undefined;
|
2616 | /**
|
2617 | * How style data should be added for imports. For example, the `queryparams` value
|
2618 | * adds the component's tagname and encapsulation info as querystring parameter
|
2619 | * to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
|
2620 | * style data can be used by bundlers to further optimize each component's css.
|
2621 | * Set to `null` to not include the querystring parameters. Default is `queryparams`.
|
2622 | */
|
2623 | styleImportData?: 'queryparams' | string | undefined;
|
2624 | /**
|
2625 | * The JavaScript source target TypeScript should to transpile to. Values can be
|
2626 | * `latest`, `esnext`, `es2017`, `es2015`, or `es5`. Defaults to `latest`.
|
2627 | */
|
2628 | target?: CompileTarget;
|
2629 | /**
|
2630 | * Create a source map. Using `inline` will inline the source map into the
|
2631 | * code, otherwise the source map will be in the returned `map` property.
|
2632 | * Default is `true`.
|
2633 | */
|
2634 | sourceMap?: boolean | 'inline';
|
2635 | /**
|
2636 | * Base directory to resolve non-relative module names. Same as the `baseUrl`
|
2637 | * TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
|
2638 | */
|
2639 | baseUrl?: string;
|
2640 | /**
|
2641 | * List of path mapping entries for module names to locations relative to the `baseUrl`.
|
2642 | * Same as the `paths` TypeScript compiler option:
|
2643 | * https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
|
2644 | */
|
2645 | paths?: {
|
2646 | [key: string]: string[];
|
2647 | };
|
2648 | /**
|
2649 | * Passed in Stencil Compiler System, otherwise falls back to the internal in-memory only system.
|
2650 | */
|
2651 | sys?: CompilerSystem;
|
2652 | /**
|
2653 | * This option enables the same behavior as {@link Config.transformAliasedImportPaths}, transforming paths aliased in
|
2654 | * `tsconfig.json` to relative paths.
|
2655 |
|