@@ -139,8 +139,14 @@ export interface StencilConfig {
139139 rollupConfig ?: RollupConfig ;
140140
141141 /**
142- * Sets if the ES5 build must be generated or not. It defaults to `false` in dev mode, and `true` in production mode.
143- * Notice that Stencil always generates a modern build too, this setting will just disable the additional `es5` build.
142+ * Sets if the ES5 build should be generated or not. It defaults to `false` in dev mode, and `true` in
143+ * production mode. Notice that Stencil always generates a modern build too, whereas this setting
144+ * will either disable es5 builds entirely with `false`, or always create es5 builds (even in dev mode)
145+ * when set to `true`. Basically if the app does not need to run on legacy browsers
146+ * (IE11 and Edge 18 and below), it's safe to set `buildEs5` to `false`, which will also speed up
147+ * production build times. In addition to not creating es5 builds, apps may also be interested in
148+ * disabling any unnecessary runtime when support legacy browsers. See
149+ * [https://stenciljs.com/docs/config-extras](/docs/config-extras) for more information.
144150 */
145151 buildEs5 ?: boolean ;
146152
@@ -267,7 +273,9 @@ export interface ConfigExtras {
267273 cssVarsShim ?: boolean ;
268274
269275 /**
270- * Dynamic `import()` shim. This is only needed for Edge 18 and below, and Firefox 67 and below.
276+ * Dynamic `import()` shim. This is only needed for Edge 18 and below, and Firefox 67
277+ * and below. If you do not need to support Edge 18 and below (Edge before it moved
278+ * to Chromium) then it's recommended to set `dynamicImportShim` to `false`.
271279 * Defaults to `true`.
272280 */
273281 dynamicImportShim ?: boolean ;
@@ -296,7 +304,8 @@ export interface ConfigExtras {
296304 * If enabled `true`, the runtime will check if the shadow dom shim is required. However,
297305 * if it's determined that shadow dom is already natively supported by the browser then
298306 * it does not request the shim. Setting to `false` will avoid all shadow dom tests.
299- * Defaults to `true`.
307+ * If the app does not need to support IE11 or Edge 18 it's recommended to set `shadowDomShim` to
308+ * `false`. Defaults to `true`.
300309 */
301310 shadowDomShim ?: boolean ;
302311
@@ -474,6 +483,130 @@ export type TaskCommand = 'build' | 'docs' | 'generate' | 'help' | 'prerender' |
474483
475484export type PageReloadStrategy = 'hmr' | 'pageReload' | null ;
476485
486+ export interface PrerenderConfig {
487+ afterHydrate ?( document ?: Document , url ?: URL ) : any | Promise < any > ;
488+ beforeHydrate ?( document ?: Document , url ?: URL ) : any | Promise < any > ;
489+ /**
490+ * Runs after the template Document object has serialize into an
491+ * HTML formatted string. Returns an HTML string to be used as the
492+ * base template for all prerendered pages.
493+ */
494+ afterSerializeTemplate ?( html : string ) : Promise < string > ;
495+ /**
496+ * Runs before the template Document object is serialize into an
497+ * HTML formatted string. Returns the Document to be serialized which
498+ * will become the base template html for all prerendered pages.
499+ */
500+ beforeSerializeTemplate ?( document : Document ) : Promise < Document > ;
501+ /**
502+ * A custom function to be used to generate the canonical `<link>` tag
503+ * which goes in the `<head>` of every prerendered page. Returning `null`
504+ * will not add a canonical url tag to the page.
505+ */
506+ canonicalUrl ?( url ?: URL ) : string | null ;
507+ /**
508+ * URLs to start the prerender crawling from. By default the root URL of `/` is used.
509+ */
510+ entryUrls ?: string [ ] ;
511+ /**
512+ * Return `true` the given `<a>` element should be crawled or not.
513+ */
514+ filterAnchor ?( attrs : { [ attrName : string ] : string } , base ?: URL ) : boolean ;
515+ /**
516+ * Return `true` if the given URL should be prerendered or not.
517+ */
518+ filterUrl ?( url ?: URL , base ?: URL ) : boolean ;
519+ /**
520+ * Returns the file path which the prerendered HTML content
521+ * should be written to.
522+ */
523+ filePath ?( url ?: URL , filePath ?: string ) : string ;
524+ /**
525+ * Returns the hydrate options to use for each individual prerendered page.
526+ */
527+ hydrateOptions ?( url ?: URL ) : PrerenderHydrateOptions ;
528+ /**
529+ * Returns the template file's content. The template is the base
530+ * HTML used for all prerendered pages.
531+ */
532+ loadTemplate ?( filePath ?: string ) : Promise < string > ;
533+ normalizeUrl ?( href ?: string , base ?: URL ) : URL ;
534+ robotsTxt ?( opts : RobotsTxtOpts ) : string | RobotsTxtResults ;
535+ sitemapXml ?( opts : SitemapXmpOpts ) : string | SitemapXmpResults ;
536+ /**
537+ * If the prerenndered URLs should have a trailing "/"" or not. Defaults to `false`.
538+ */
539+ trailingSlash ?: boolean ;
540+ }
541+
542+ export interface HydrateDocumentOptions {
543+ canonicalUrl ?: string ;
544+ constrainTimeouts ?: boolean ;
545+ clientHydrateAnnotations ?: boolean ;
546+ cookie ?: string ;
547+ direction ?: string ;
548+ excludeComponents ?: string [ ] ;
549+ language ?: string ;
550+ maxHydrateCount ?: number ;
551+ referrer ?: string ;
552+ removeScripts ?: boolean ;
553+ removeUnusedStyles ?: boolean ;
554+ resourcesUrl ?: string ;
555+ timeout ?: number ;
556+ title ?: string ;
557+ url ?: string ;
558+ userAgent ?: string ;
559+ }
560+
561+ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
562+ afterHydrate ?( document : any ) : any | Promise < any > ;
563+ approximateLineWidth ?: number ;
564+ beforeHydrate ?( document : any ) : any | Promise < any > ;
565+ prettyHtml ?: boolean ;
566+ removeAttributeQuotes ?: boolean ;
567+ removeBooleanAttributeQuotes ?: boolean ;
568+ removeEmptyAttributes ?: boolean ;
569+ removeHtmlComments ?: boolean ;
570+ }
571+
572+ export interface HydrateFactoryOptions extends SerializeDocumentOptions {
573+ serializeToHtml : boolean ;
574+ destroyWindow : boolean ;
575+ destroyDocument : boolean ;
576+ }
577+
578+ export interface PrerenderHydrateOptions extends SerializeDocumentOptions {
579+ addModulePreloads ?: boolean ;
580+ inlineExternalStyleSheets ?: boolean ;
581+ minifyStyleElements ?: boolean ;
582+ minifyScriptElements ?: boolean ;
583+ }
584+
585+ export interface RobotsTxtOpts {
586+ urls : string [ ] ;
587+ sitemapUrl : string ;
588+ baseUrl : string ;
589+ dir : string ;
590+ }
591+
592+ export interface RobotsTxtResults {
593+ content : string ;
594+ filePath : string ;
595+ url : string ;
596+ }
597+
598+ export interface SitemapXmpOpts {
599+ urls : string [ ] ;
600+ baseUrl : string ;
601+ dir : string ;
602+ }
603+
604+ export interface SitemapXmpResults {
605+ content : string ;
606+ filePath : string ;
607+ url : string ;
608+ }
609+
477610export interface CompilerSystem {
478611 events ?: BuildEvents ;
479612 details ?: SystemDetails ;
0 commit comments