@stencil/core 5.0.0-alpha.4 → 5.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{client-Dti6fFpE.mjs → client-fWOou5EW.mjs} +2360 -2090
  2. package/dist/compiler/index.d.mts +5 -5
  3. package/dist/compiler/index.mjs +2 -2
  4. package/dist/compiler/utils/index.d.mts +2 -2
  5. package/dist/compiler/utils/index.mjs +3 -3
  6. package/dist/{compiler-BYRrEeD-.mjs → compiler-CdUbDTbV.mjs} +13426 -12276
  7. package/dist/declarations/stencil-public-compiler.d.ts +527 -238
  8. package/dist/declarations/stencil-public-compiler.js +2 -3
  9. package/dist/declarations/stencil-public-docs.d.ts +10 -0
  10. package/dist/declarations/stencil-public-runtime.d.ts +51 -12
  11. package/dist/{index-BwTaN1Nq.d.mts → index-D8vvsppY.d.mts} +566 -350
  12. package/dist/{index-CyrGY82h.d.ts → index-Dap2E02-.d.ts} +83 -32
  13. package/dist/{index-9LTuoSiw.d.mts → index-UUlemGuu.d.mts} +13 -2
  14. package/dist/index.d.mts +0 -1
  15. package/dist/index.mjs +1 -1
  16. package/dist/jsx-runtime.d.mts +18 -0
  17. package/dist/jsx-runtime.mjs +2 -0
  18. package/dist/{node-BF2jSfWg.mjs → node-klLZLdDe.mjs} +20 -19
  19. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-DUdhF3Ei.mjs} +113 -29
  20. package/dist/runtime/app-data/index.d.ts +1 -1
  21. package/dist/runtime/app-data/index.js +15 -9
  22. package/dist/{runtime-COEYYPyw.js → runtime/client/lazy.js} +2596 -2182
  23. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +89 -47
  24. package/dist/runtime/client/{index.js → runtime.js} +2473 -2183
  25. package/dist/runtime/index.d.ts +46 -5
  26. package/dist/runtime/index.js +4956 -2
  27. package/dist/runtime/server/index.d.mts +85 -63
  28. package/dist/runtime/server/index.mjs +2462 -2193
  29. package/dist/runtime/server/runner.d.mts +44 -32
  30. package/dist/runtime/server/runner.mjs +335 -383
  31. package/dist/signals/index.d.ts +47 -0
  32. package/dist/signals/index.js +199 -0
  33. package/dist/sys/node/index.d.mts +1 -1
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.mjs +2 -2
  36. package/dist/testing/index.d.mts +97 -3
  37. package/dist/testing/index.mjs +197 -45
  38. package/dist/{validation-Byxie0Uk.mjs → validation-2QipI30K.mjs} +90 -77
  39. package/package.json +41 -28
  40. package/dist/index-hS-KBdAP.d.ts +0 -30
  41. package/dist/jsx-runtime-DlDkTqps.d.ts +0 -28
  42. package/dist/jsx-runtime.d.ts +0 -2
  43. package/dist/jsx-runtime.js +0 -2
  44. /package/dist/{chunk-CjcI7cDX.mjs → chunk-z9aeyW2b.mjs} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { ListenTargetOptions, ResolutionHandler } from "./stencil-public-runtime.js";
2
+ import { InputOptions, SourceMap as RolldownSourceMap } from "rolldown";
2
3
  //#region src/utils/result.d.ts
3
4
  /**
4
5
  * A Result wraps up a success state and a failure state, allowing you to
@@ -670,6 +671,103 @@ interface PrintLine {
670
671
  errorCharStart: number;
671
672
  errorLength?: number;
672
673
  }
674
+ interface BuildFeatures {
675
+ style: boolean;
676
+ mode: boolean;
677
+ formAssociated: boolean;
678
+ shadowDom: boolean;
679
+ shadowDelegatesFocus: boolean;
680
+ shadowModeClosed: boolean;
681
+ shadowSlotAssignmentManual: boolean;
682
+ scoped: boolean;
683
+ /**
684
+ * Every component has a render function
685
+ */
686
+ allRenderFn: boolean;
687
+ /**
688
+ * At least one component has a render function
689
+ */
690
+ hasRenderFn: boolean;
691
+ vdomRender: boolean;
692
+ vdomAttribute: boolean;
693
+ vdomClass: boolean;
694
+ vdomFunctional: boolean;
695
+ vdomKey: boolean;
696
+ vdomListener: boolean;
697
+ vdomPropOrAttr: boolean;
698
+ vdomRef: boolean;
699
+ vdomStyle: boolean;
700
+ vdomText: boolean;
701
+ vdomXlink: boolean;
702
+ vdomSignals: boolean;
703
+ slotRelocation: boolean;
704
+ patchAll: boolean;
705
+ patchChildren: boolean;
706
+ patchClone: boolean;
707
+ patchInsert: boolean;
708
+ slot: boolean;
709
+ svg: boolean;
710
+ element: boolean;
711
+ event: boolean;
712
+ hostListener: boolean;
713
+ hostListenerTargetWindow: boolean;
714
+ hostListenerTargetDocument: boolean;
715
+ hostListenerTargetBody: boolean;
716
+ hostListenerTarget: boolean;
717
+ method: boolean;
718
+ prop: boolean;
719
+ propChangeCallback: boolean;
720
+ propMutable: boolean;
721
+ state: boolean;
722
+ member: boolean;
723
+ updatable: boolean;
724
+ propBoolean: boolean;
725
+ propNumber: boolean;
726
+ propString: boolean;
727
+ serializer: boolean;
728
+ deserializer: boolean;
729
+ lifecycle: boolean;
730
+ asyncLoading: boolean;
731
+ observeAttribute: boolean;
732
+ reflect: boolean;
733
+ taskQueue: boolean;
734
+ }
735
+ interface BuildConditionals extends Partial<BuildFeatures> {
736
+ hotModuleReplacement?: boolean;
737
+ isDebug?: boolean;
738
+ isTesting?: boolean;
739
+ isDev?: boolean;
740
+ devTools?: boolean;
741
+ invisiblePrehydration?: boolean;
742
+ hydrateServerSide?: boolean;
743
+ hydrateClientSide?: boolean;
744
+ lifecycleDOMEvents?: boolean;
745
+ cssAnnotations?: boolean;
746
+ lazyLoad?: boolean;
747
+ profile?: boolean;
748
+ constructableCSS?: boolean;
749
+ /** True when `extras.lightDomPatches === true` - enables `applyLightDomPatches` shortcut. */
750
+ lightDomPatches?: boolean;
751
+ /** Patch `childNodes`/`children` getters on light-dom slotted components. */
752
+ slotChildNodes?: boolean;
753
+ /** Patch `cloneNode()` on light-dom slotted components. */
754
+ slotCloneNode?: boolean;
755
+ /** Patch `appendChild`/`insertBefore`/`removeChild` on light-dom slotted components. */
756
+ slotDomMutations?: boolean;
757
+ /** Patch `textContent` on light-dom slotted components. */
758
+ slotTextContent?: boolean;
759
+ hydratedAttribute?: boolean;
760
+ hydratedClass?: boolean;
761
+ hydratedSelectorName?: string;
762
+ /** True when a global-style input contains `@import "stencil-hydrate"` - suppresses dynamic style injection in the loader. */
763
+ staticHydrationStyles?: boolean;
764
+ initializeNextTick?: boolean;
765
+ asyncQueue?: boolean;
766
+ additionalTagTransformers?: boolean | 'prod';
767
+ signalBacking?: boolean;
768
+ /** True when JSX signal bypass is active - text nodes and attributes backed by Signal objects update the DOM directly. Auto-enabled when `signalBacking: true`. */
769
+ vdomSignals?: boolean;
770
+ }
673
771
  type ModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd' | 'commonjs' | 'esm' | 'module' | 'systemjs';
674
772
  interface RolldownResultModule {
675
773
  id: string;
@@ -715,9 +813,11 @@ interface BuildCtx {
715
813
  hasScriptChanges: boolean;
716
814
  hasStyleChanges: boolean;
717
815
  hasWarning: boolean;
718
- hydrateAppFilePath: string;
816
+ ssrAppFilePath: string;
719
817
  indexBuildCount: number;
720
818
  indexDoc: Document;
819
+ /** All non-entry HTML files found in srcDir, keyed by path relative to srcDir */
820
+ htmlDocs: Map<string, Document>;
721
821
  isRebuild: boolean;
722
822
  /**
723
823
  * A collection of Stencil's intermediate representation of components, tied to the current build
@@ -767,8 +867,6 @@ interface CompilerBuildStats {
767
867
  options: {
768
868
  minifyJs: boolean;
769
869
  minifyCss: boolean;
770
- hashFileNames: boolean;
771
- hashedFileNameLength: number;
772
870
  };
773
871
  formats: {
774
872
  esmBrowser: ReadonlyArray<CompilerBuildStatBundle>;
@@ -817,16 +915,6 @@ interface RolldownChunkResult {
817
915
  moduleFormat: ModuleFormat;
818
916
  map?: RolldownSourceMap;
819
917
  }
820
- interface RolldownSourceMap {
821
- file: string;
822
- mappings: string;
823
- names: string[];
824
- sources: string[];
825
- sourcesContent: string[];
826
- version: number;
827
- toString(): string;
828
- toUrl(): string;
829
- }
830
918
  interface BundleModule {
831
919
  entryKey: string;
832
920
  rolldownResult: RolldownChunkResult;
@@ -862,6 +950,7 @@ interface CollectionCompilerMeta {
862
950
  bundles?: {
863
951
  components: string[];
864
952
  }[];
953
+ buildFlags?: Partial<BuildConditionals>;
865
954
  }
866
955
  interface CollectionCompilerVersion {
867
956
  name: string;
@@ -899,7 +988,8 @@ interface CompilerCtx {
899
988
  addWatchFile: (path: string) => void;
900
989
  cache: Cache;
901
990
  cssModuleImports: Map<string, string[]>;
902
- cachedGlobalStyle: string;
991
+ /** Cache of built global styles, keyed by input file path */
992
+ globalStyleCache: Map<string, string>;
903
993
  collections: CollectionCompilerMeta[];
904
994
  compilerOptions: any;
905
995
  events: BuildEvents;
@@ -913,7 +1003,7 @@ interface CompilerCtx {
913
1003
  moduleMap: ModuleMap;
914
1004
  nodeMap: NodeMap;
915
1005
  resolvedCollections: Set<string>;
916
- rolldownCacheHydrate: any;
1006
+ rolldownCacheSsr: any;
917
1007
  rolldownCacheLazy: any;
918
1008
  rolldownCacheNative: any;
919
1009
  styleModeNames: Set<string>;
@@ -921,6 +1011,22 @@ interface CompilerCtx {
921
1011
  changedFiles: Set<string>;
922
1012
  worker?: CompilerWorkerContext;
923
1013
  rolldownCache: Map<string, any>;
1014
+ /**
1015
+ * Cross-build cache for {@link ts.transpileModule} results.
1016
+ * Keyed by `"${bundleId}:${normalizedFilePath}"`. Invalidated for any
1017
+ * file that appears in {@link changedModules} after TypeScript re-emits.
1018
+ * @see transpileCache in compiler-ctx.ts
1019
+ */
1020
+ transpileCache: Map<string, {
1021
+ outputText: string;
1022
+ sourceMapText: string | null;
1023
+ }>;
1024
+ /**
1025
+ * Cross-build cache of the last style text pushed to the HMR client.
1026
+ * Keyed by getScopeId result (e.g. "ion-accordion$ios"). Used by
1027
+ * extTransformsPlugin to avoid re-pushing unchanged styles on every rebuild.
1028
+ */
1029
+ prevStylesMap: Map<string, string>;
924
1030
  /**
925
1031
  * Cross-output-target cache for the SASS + Lightning CSS computation.
926
1032
  * Keyed by the annotated Rolldown import id. Null entries indicate that the
@@ -991,6 +1097,7 @@ interface ComponentCompilerFeatures {
991
1097
  hasVdomStyle: boolean;
992
1098
  hasVdomText: boolean;
993
1099
  hasVdomXlink: boolean;
1100
+ hasSignalsImport: boolean;
994
1101
  hasWatchCallback: boolean;
995
1102
  htmlAttrNames: string[];
996
1103
  htmlTagNames: string[];
@@ -1088,6 +1195,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1088
1195
  states: ComponentCompilerState[];
1089
1196
  styleDocs: CompilerStyleDoc[];
1090
1197
  styles: StyleCompiler[];
1198
+ globalStyles: ComponentGlobalStyle[];
1091
1199
  tagName: string;
1092
1200
  virtualProperties: ComponentCompilerVirtualProperty[];
1093
1201
  watchers: ComponentCompilerChangeHandler[];
@@ -1104,7 +1212,7 @@ type Encapsulation = 'shadow' | 'scoped' | 'none';
1104
1212
  * These enable proper slot behavior when not using native Shadow DOM.
1105
1213
  */
1106
1214
  interface ComponentPatches {
1107
- /** Apply all slot patches (equivalent to experimentalSlotFixes) */
1215
+ /** Apply all slot patches (equivalent to lightDomPatches) */
1108
1216
  all?: boolean;
1109
1217
  /** Patch child node accessors (children, firstChild, lastChild, etc.) */
1110
1218
  children?: boolean;
@@ -1164,6 +1272,11 @@ interface ComponentCompilerPropertyComplexType {
1164
1272
  * annotation in the original source file.
1165
1273
  */
1166
1274
  references: ComponentCompilerTypeReferences;
1275
+ /**
1276
+ * @internal TypeScript AST node used for semantic type analysis during compilation.
1277
+ * Not serialized, only used internally for improved type renaming logic.
1278
+ */
1279
+ _astNode?: any;
1167
1280
  }
1168
1281
  /**
1169
1282
  * A record of `ComponentCompilerTypeReference` entities.
@@ -1257,6 +1370,11 @@ interface ComponentCompilerMethodComplexType {
1257
1370
  parameters: JsonDocMethodParameter[];
1258
1371
  references: ComponentCompilerTypeReferences;
1259
1372
  return: string;
1373
+ /**
1374
+ * @internal TypeScript AST method node used for semantic type analysis during compilation.
1375
+ * Not serialized, only used internally for improved type renaming logic.
1376
+ */
1377
+ _astNode?: any;
1260
1378
  }
1261
1379
  interface ComponentCompilerChangeHandler {
1262
1380
  propName: string;
@@ -1421,6 +1539,7 @@ interface Module {
1421
1539
  hasVdomStyle: boolean;
1422
1540
  hasVdomText: boolean;
1423
1541
  hasVdomXlink: boolean;
1542
+ hasSignalsImport: boolean;
1424
1543
  }
1425
1544
  interface PrerenderUrlResults {
1426
1545
  anchorUrls: string[];
@@ -1433,7 +1552,7 @@ interface PrerenderUrlRequest {
1433
1552
  baseUrl: string;
1434
1553
  componentGraphPath: string;
1435
1554
  devServerHostUrl: string;
1436
- hydrateAppFilePath: string;
1555
+ ssrAppFilePath: string;
1437
1556
  isDebug: boolean;
1438
1557
  prerenderConfigPath: string;
1439
1558
  staticSite: boolean;
@@ -1453,6 +1572,12 @@ interface ExternalStyleCompiler {
1453
1572
  relativePath: string;
1454
1573
  originalComponentPath: string;
1455
1574
  }
1575
+ interface ComponentGlobalStyle {
1576
+ /** Absolute path to the CSS file, or null for inline styles */
1577
+ absolutePath: string | null;
1578
+ /** Raw inline CSS string, or null for file-based styles */
1579
+ styleStr: string | null;
1580
+ }
1456
1581
  /**
1457
1582
  * Input CSS to be transformed into ESM
1458
1583
  */
@@ -1516,7 +1641,6 @@ interface PackageJsonData {
1516
1641
  browser?: string;
1517
1642
  module?: string;
1518
1643
  'jsnext:main'?: string;
1519
- 'collection:main'?: string;
1520
1644
  unpkg?: string;
1521
1645
  collection?: string;
1522
1646
  types?: string;
@@ -1643,20 +1767,6 @@ interface StencilConfig {
1643
1767
  * @default false
1644
1768
  */
1645
1769
  generateExportMaps?: boolean;
1646
- /**
1647
- * When the hashFileNames config is set to true, and it is a production build,
1648
- * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
1649
- */
1650
- hashedFileNameLength?: number;
1651
- /**
1652
- * During production builds, the content of each generated file is hashed to represent the content,
1653
- * and the hashed value is used as the filename. If the content isn't updated between builds,
1654
- * then it receives the same filename. When the content is updated, then the filename is different.
1655
- *
1656
- * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
1657
- * content delivery networks (CDNs) and heavily caching files for faster apps.
1658
- */
1659
- hashFileNames?: boolean;
1660
1770
  /**
1661
1771
  * The namespace config is a string representing a namespace for the app.
1662
1772
  * For apps that are not meant to be a library of reusable components,
@@ -1702,11 +1812,6 @@ interface StencilConfig {
1702
1812
  * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1703
1813
  */
1704
1814
  suppressReservedPublicNameWarnings?: boolean;
1705
- /**
1706
- * When `true`, we will validate a project's `package.json` based on the output target the user has designated
1707
- * as `isPrimaryPackageOutputTarget: true` in their Stencil config.
1708
- */
1709
- validatePrimaryPackageOutputTarget?: boolean;
1710
1815
  /**
1711
1816
  * Passes custom configuration down to the "@rolldown/plugin-node-resolve" that Stencil uses under the hood.
1712
1817
  * For further information: https://stenciljs.com/docs/module-bundling
@@ -1726,13 +1831,6 @@ interface StencilConfig {
1726
1831
  * Defaults to `false` in dev mode and `true` in production mode.
1727
1832
  */
1728
1833
  minifyCss?: boolean;
1729
- /**
1730
- * Forces Stencil to run in `dev` mode if the value is `true` and `production` mode
1731
- * if it's `false`.
1732
- *
1733
- * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
1734
- */
1735
- devMode?: boolean;
1736
1834
  /**
1737
1835
  * Object to provide a custom logger. By default a `logger` is already provided for the
1738
1836
  * platform the compiler is running on, such as NodeJS or a browser.
@@ -1808,14 +1906,6 @@ interface StencilConfig {
1808
1906
  after?: any[];
1809
1907
  };
1810
1908
  entryComponentsHint?: string[];
1811
- /**
1812
- * Sets whether Stencil will write files to `dist/` during the build or not.
1813
- *
1814
- * By default this value is set to the opposite value of {@link devMode},
1815
- * i.e. it will be `true` when building for production and `false` when
1816
- * building for development.
1817
- */
1818
- buildDist?: boolean;
1819
1909
  buildLogFilePath?: string;
1820
1910
  devInspector?: boolean;
1821
1911
  devServer?: StencilDevServerConfig;
@@ -1843,7 +1933,7 @@ interface StencilConfig {
1843
1933
  * An array of component tag names to exclude from production builds.
1844
1934
  * Useful to remove test, demo or experimental components from final output.
1845
1935
  *
1846
- * **Note:** Exclusion only applies to production builds (default, or when `--prod` is used).
1936
+ * **Note:** Exclusion only applies to production builds (the default).
1847
1937
  * Development builds (with `--dev` flag) will include all components to support local testing.
1848
1938
  *
1849
1939
  * Supports glob patterns for matching multiple components:
@@ -1867,6 +1957,23 @@ interface StencilConfig {
1867
1957
  * Set whether unused dependencies should be excluded from the built output.
1868
1958
  */
1869
1959
  excludeUnusedDependencies?: boolean;
1960
+ /**
1961
+ * Explicitly declare which npm packages are Stencil collections to be re-bundled into this project.
1962
+ *
1963
+ * Without this option, collection ingestion is triggered only by a side-effect import:
1964
+ * ```ts
1965
+ * import '@ionic/core';
1966
+ * ```
1967
+ * @example
1968
+ * ```ts
1969
+ * export const config: Config = {
1970
+ * collections: ['@ionic/core', '@my-org/design-system'],
1971
+ * };
1972
+ * ```
1973
+ *
1974
+ * @default []
1975
+ */
1976
+ collections?: string[];
1870
1977
  stencilCoreResolvedId?: string;
1871
1978
  }
1872
1979
  interface ConfigExtrasBase {
@@ -1874,7 +1981,7 @@ interface ConfigExtrasBase {
1874
1981
  * Projects that use a Stencil library built using the `dist` output target may have trouble lazily
1875
1982
  * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
1876
1983
  * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
1877
- * the size of the compiled output. Defaults to `false`.
1984
+ * the size of the compiled output. Defaults to `true`.
1878
1985
  */
1879
1986
  enableImportInjection?: boolean;
1880
1987
  /**
@@ -1893,66 +2000,51 @@ interface ConfigExtrasBase {
1893
2000
  */
1894
2001
  additionalTagTransformers?: boolean | 'prod';
1895
2002
  /**
1896
- * Experimental flag.
1897
- * Updates the behavior of scoped components to align more closely with the behavior of the native
1898
- * Shadow DOM when using `slot`s.
2003
+ * Replace `@State` and `@Prop` internals with `@preact/signals-core` signal primitives.
2004
+ * Enables cross-framework reactive interop - component state becomes subscribable by
2005
+ * Solid, Angular, Preact and any TC39-signal-compatible library without event/attribute
2006
+ * roundtrips. No API changes required in component code.
1899
2007
  * Defaults to `false`.
1900
2008
  */
1901
- experimentalScopedSlotChanges?: boolean;
2009
+ signalBacking?: boolean;
1902
2010
  /**
1903
- * By default Stencil turns the stylesheet provided to `globalStyle` into a constructable stylesheet
1904
- * and adds it to each component when rendered on the client which can be useful for sharing styles
1905
- * efficiently across components.
1906
- *
1907
- * If you want Stencil to also add the `globalStyle` to each component when rendering on the server
1908
- * then set this to `true`. If your `globalStyle` sheet is large then doing this may bloat the size
1909
- * of your SSR output when using declarative-shadow-dom.
1910
- *
1911
- * Setting this to `false` will prevent Stencil from adding any `globalStyle` to each component.
1912
- *
1913
- * Defaults to `'client'`.
2011
+ * Enable JSX signal bypass: `Signal` objects passed as JSX text children or attribute values
2012
+ * subscribe directly to DOM nodes, bypassing the vdom diff on signal changes.
2013
+ * Also enables `<Show>` from `@stencil/core/signals`.
2014
+ * Auto-enabled when `signalBacking: true`. Defaults to `false`.
1914
2015
  */
1915
- addGlobalStyleToComponents?: boolean | 'client';
2016
+ vdomSignals?: boolean;
1916
2017
  }
1917
- type ConfigExtrasSlotFixes<ExperimentalFixesEnabled extends boolean, IndividualFlags extends boolean> = {
1918
- /**
1919
- * By default, the slot polyfill does not update `appendChild()` so that it appends
1920
- * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
1921
- * polyfill for those who need it when using `element.appendChild(node)` and expecting the
1922
- * child to be appended in the same location shadow dom would. This is not required for
1923
- * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
1924
- */
1925
- appendChildSlotFix?: IndividualFlags;
1926
- /**
1927
- * By default, the runtime does not polyfill `cloneNode()` when cloning a component
1928
- * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
1929
- * This is not required for IE11 or Edge 18, but can be enabled if the app is using
1930
- * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
1931
- * simulating shadow dom. Defaults to `false`.
1932
- */
1933
- cloneNodeFix?: IndividualFlags;
1934
- /**
1935
- * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
1936
- * component that uses the shadow DOM. Defaults to `false`
1937
- */
1938
- scopedSlotTextContentFix?: IndividualFlags;
1939
- /**
1940
- * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
1941
- * to simulate the same behavior. However, the host element's `childNodes` and `children`
1942
- * getters are not patched to only show the child nodes and elements of the default slot.
1943
- * Defaults to `false`.
1944
- */
1945
- slotChildNodesFix?: IndividualFlags;
2018
+ /**
2019
+ * DOM patches for light-dom / scoped components that use `<slot>`.
2020
+ *
2021
+ * These patches shield the component's slot machinery from framework DOM mutations
2022
+ * (e.g. when Angular or React insert / remove nodes they route directly to the host
2023
+ * element, bypassing the slot polyfill) and prevent hydration errors when a framework
2024
+ * encounters Stencil's internal slot reference nodes during SSR reconciliation.
2025
+ *
2026
+ * Patches are only applied at runtime when a component is both non-shadow **and**
2027
+ * declares at least one `<slot>`, so enabling them has no effect on pure shadow-DOM
2028
+ * components.
2029
+ *
2030
+ * Set to `true` (default) to enable all patches, `false` to disable all, or an object
2031
+ * for granular control.
2032
+ */
2033
+ type LightDomPatches = {
2034
+ /** Patches `childNodes`/`children` getters to return only slotted content. */childNodes?: boolean; /** Patches `cloneNode()` to correctly deep-clone slotted content. */
2035
+ cloneNode?: boolean; /** Patches `appendChild()`, `insertBefore()`, and `removeChild()` to route to the correct slot. */
2036
+ domMutations?: boolean; /** Patches `textContent` to act like shadow DOM (reads/writes slotted text only). */
2037
+ textContent?: boolean;
2038
+ };
2039
+ type ConfigExtras = ConfigExtrasBase & {
1946
2040
  /**
1947
- * Enables all slot-related fixes such as {@link slotChildNodesFix}, and
1948
- * {@link scopedSlotTextContentFix}.
2041
+ * DOM patches for light-dom / scoped components that use `<slot>`.
2042
+ * See {@link LightDomPatches} for granular control. Defaults to `true`.
1949
2043
  */
1950
- experimentalSlotFixes?: ExperimentalFixesEnabled;
2044
+ lightDomPatches?: boolean | LightDomPatches;
1951
2045
  };
1952
- type ConfigExtras = ConfigExtrasBase & (ConfigExtrasSlotFixes<true, true> | ConfigExtrasSlotFixes<false, boolean>);
1953
2046
  interface Config extends StencilConfig {
1954
2047
  buildAppCore?: boolean;
1955
- buildDocs?: boolean;
1956
2048
  configPath?: string;
1957
2049
  writeLog?: boolean;
1958
2050
  devServer?: DevServerConfig;
@@ -1966,6 +2058,11 @@ interface Config extends StencilConfig {
1966
2058
  tsWatchOptions?: any;
1967
2059
  _isValidated?: boolean;
1968
2060
  _isTesting?: boolean;
2061
+ /**
2062
+ * Internal flag set when --docs CLI flag is used.
2063
+ * Forces docs output targets to build even in dev mode.
2064
+ */
2065
+ _docsFlag?: boolean;
1969
2066
  /**
1970
2067
  * Whether running in a CI environment (disables interactive features, adjusts worker count)
1971
2068
  */
@@ -2048,7 +2145,7 @@ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
2048
2145
  /**
2049
2146
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2050
2147
  */
2051
- type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devMode' | 'devServer' | 'extras' | 'fsNamespace' | 'hashFileNames' | 'hashedFileNameLength' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths' | 'validatePrimaryPackageOutputTarget'>;
2148
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'extras' | 'fsNamespace' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2052
2149
  /**
2053
2150
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2054
2151
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -2056,6 +2153,11 @@ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devMode' | 'devServer
2056
2153
  * validations have occurred at runtime.
2057
2154
  */
2058
2155
  type ValidatedConfig = RequireFields<Config, StrictConfigFields> & {
2156
+ /**
2157
+ * Whether the build is running in development mode.
2158
+ * Set by the `--dev` CLI flag. Not user-configurable in `stencil.config.ts`.
2159
+ */
2160
+ devMode: boolean;
2059
2161
  sourceMap: boolean;
2060
2162
  };
2061
2163
  interface HydratedFlag {
@@ -2260,11 +2362,11 @@ interface PrerenderConfig {
2260
2362
  * Run after each `document` is hydrated, but before it is serialized
2261
2363
  * into an HTML string. Hook is passed the `document` and its `URL`.
2262
2364
  */
2263
- afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2365
+ afterSsr?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2264
2366
  /**
2265
2367
  * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
2266
2368
  */
2267
- beforeHydrate?(document: Document, url: URL): any | Promise<any>;
2369
+ beforeSsr?(document: Document, url: URL): any | Promise<any>;
2268
2370
  /**
2269
2371
  * Runs after the template Document object has serialize into an
2270
2372
  * HTML formatted string. Returns an HTML string to be used as the
@@ -2308,9 +2410,9 @@ interface PrerenderConfig {
2308
2410
  */
2309
2411
  filePath?(url: URL, filePath: string): string;
2310
2412
  /**
2311
- * Returns the hydrate options to use for each individual prerendered page.
2413
+ * Returns the prerender options to use for each individual prerendered page.
2312
2414
  */
2313
- hydrateOptions?(url: URL): PrerenderHydrateOptions;
2415
+ prerenderOptions?(url: URL): PrerenderOptions;
2314
2416
  /**
2315
2417
  * Returns the template file's content. The template is the base
2316
2418
  * HTML used for all prerendered pages.
@@ -2334,7 +2436,7 @@ interface PrerenderConfig {
2334
2436
  */
2335
2437
  trailingSlash?: boolean;
2336
2438
  }
2337
- interface HydrateDocumentOptions {
2439
+ interface SsrDocumentOptions {
2338
2440
  /**
2339
2441
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
2340
2442
  * a random ID will be generated
@@ -2351,7 +2453,7 @@ interface HydrateDocumentOptions {
2351
2453
  * JavaScript to read the structure of the HTML and rebuild each
2352
2454
  * component. Defaults to `true`.
2353
2455
  */
2354
- clientHydrateAnnotations?: boolean;
2456
+ clientSsrAnnotations?: boolean;
2355
2457
  /**
2356
2458
  * Constrain `setTimeout()` to 1ms, but still async. Also
2357
2459
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -2450,10 +2552,19 @@ interface HydrateDocumentOptions {
2450
2552
  default: 'declarative-shadow-dom' | 'scoped';
2451
2553
  } | boolean;
2452
2554
  }
2453
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
2555
+ /**
2556
+ * Backwards compat for v4
2557
+ * @deprecated - use SsrDocumentOptions instead
2558
+ */
2559
+ interface HydrateDocumentOptions extends SsrDocumentOptions {}
2560
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
2454
2561
  /**
2455
2562
  * Runs after the `document` has been hydrated.
2456
2563
  */
2564
+ afterSsr?(document: any): any | Promise<any>;
2565
+ /**
2566
+ * @deprecated Use `afterSsr` instead.
2567
+ */
2457
2568
  afterHydrate?(document: any): any | Promise<any>;
2458
2569
  /**
2459
2570
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -2466,6 +2577,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2466
2577
  /**
2467
2578
  * Runs before the `document` has been hydrated.
2468
2579
  */
2580
+ beforeSsr?(document: any): any | Promise<any>;
2581
+ /**
2582
+ * @deprecated Use `beforeSsr` instead.
2583
+ */
2469
2584
  beforeHydrate?(document: any): any | Promise<any>;
2470
2585
  /**
2471
2586
  * Format the HTML in a nicely indented format.
@@ -2503,12 +2618,17 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2503
2618
  */
2504
2619
  modes?: ResolutionHandler[];
2505
2620
  }
2506
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
2621
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
2507
2622
  serializeToHtml: boolean;
2508
2623
  destroyWindow: boolean;
2509
2624
  destroyDocument: boolean;
2510
2625
  }
2511
- interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2626
+ /**
2627
+ * Backwards compat for v4
2628
+ * @deprecated - use SsrFactoryOptions instead
2629
+ */
2630
+ interface HydrateFactoryOptions extends SsrFactoryOptions {}
2631
+ interface PrerenderOptions extends SerializeDocumentOptions {
2512
2632
  /**
2513
2633
  * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
2514
2634
  * Defaults to `true`.
@@ -2543,6 +2663,11 @@ interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2543
2663
  */
2544
2664
  staticDocument?: boolean;
2545
2665
  }
2666
+ /**
2667
+ * v4 backwards compat
2668
+ * @deprecated - use PrerenderOptions instead
2669
+ */
2670
+ interface PrerenderHydrateOptions extends PrerenderOptions {}
2546
2671
  interface RobotsTxtOpts {
2547
2672
  urls: string[];
2548
2673
  sitemapUrl: string;
@@ -2851,18 +2976,18 @@ interface ResolveModuleIdResults {
2851
2976
  * A controller which provides for communication and coordination between
2852
2977
  * threaded workers.
2853
2978
  */
2854
- interface WorkerMainController {
2979
+ interface WorkerMainController<T extends Record<string, (...args: any[]) => Promise<any>> = Record<string, (...args: any[]) => Promise<any>>> {
2855
2980
  /**
2856
2981
  * Send a given set of arguments to a worker
2857
2982
  */
2858
- send(...args: any[]): Promise<any>;
2983
+ send<K extends keyof T>(methodName: K, ...args: Parameters<T[K]>): ReturnType<T[K]>;
2859
2984
  /**
2860
2985
  * Handle a particular method
2861
2986
  *
2862
2987
  * @param name of the method to be passed to a worker
2863
2988
  * @returns a Promise wrapping the results
2864
2989
  */
2865
- handler(name: string): (...args: any[]) => Promise<any>;
2990
+ handler<K extends keyof T>(name: K): T[K];
2866
2991
  /**
2867
2992
  * Destroy the worker represented by this instance, rejecting all outstanding
2868
2993
  * tasks and killing the child process.
@@ -2929,6 +3054,7 @@ interface BuildNoChangeResults {
2929
3054
  interface CompilerBuildResults {
2930
3055
  buildId: number;
2931
3056
  componentGraph?: BuildResultsComponentGraph;
3057
+ components: ComponentCompilerMeta[];
2932
3058
  diagnostics: Diagnostic[];
2933
3059
  dirsAdded: string[];
2934
3060
  dirsDeleted: string[];
@@ -2940,7 +3066,7 @@ interface CompilerBuildResults {
2940
3066
  hasError: boolean;
2941
3067
  hasSuccessfulBuild: boolean;
2942
3068
  hmr?: HotModuleReplacement;
2943
- hydrateAppFilePath?: string;
3069
+ ssrAppFilePath?: string;
2944
3070
  isRebuild: boolean;
2945
3071
  namespace: string;
2946
3072
  outputs: BuildOutput[];
@@ -3103,8 +3229,8 @@ interface ConfigBundle {
3103
3229
  }
3104
3230
  /**
3105
3231
  * A file and/or directory copy operation that may be specified as part of
3106
- * certain output targets for Stencil (in particular `dist`,
3107
- * `dist-custom-elements`, and `www`).
3232
+ * certain output targets for Stencil (in particular `loader-bundle`,
3233
+ * `standalone`, and `www`).
3108
3234
  */
3109
3235
  interface CopyTask {
3110
3236
  /**
@@ -3125,8 +3251,9 @@ interface CopyTask {
3125
3251
  */
3126
3252
  dest?: string;
3127
3253
  /**
3128
- * An optional array of glob patterns to exclude from the copy operation.
3129
- * @default ['**\/__mocks__/**', '**\/__fixtures__/**', '**\/dist/**', '**\/.{idea,git,cache,output,temp}/**', '**\/.ds_store', '**\/.gitignore', '**\/desktop.ini', '**\/thumbs.db']
3254
+ * Additional glob patterns to exclude from the copy operation, merged with
3255
+ * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
3256
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
3130
3257
  */
3131
3258
  ignore?: string[];
3132
3259
  /**
@@ -3205,39 +3332,12 @@ interface StencilDocsConfig {
3205
3332
  };
3206
3333
  };
3207
3334
  }
3208
- interface NodeResolveConfig {
3209
- exportConditions?: string[];
3210
- browser?: boolean;
3211
- moduleDirectories?: string[];
3212
- modulePaths?: string[];
3213
- dedupe?: string[] | ((importee: string) => boolean);
3214
- extensions?: readonly string[];
3215
- jail?: string;
3216
- mainFields?: readonly string[];
3217
- modulesOnly?: boolean;
3218
- preferBuiltins?: boolean | ((module: string) => boolean);
3219
- resolveOnly?: ReadonlyArray<string | RegExp> | null | ((module: string) => boolean);
3220
- rootDir?: string;
3221
- allowExportsFolderMapping?: boolean;
3222
- }
3335
+ /** Options for rolldown's built-in module resolver, passed directly to rolldown's `resolve` input option. */
3336
+ type NodeResolveConfig = NonNullable<InputOptions['resolve']>;
3223
3337
  interface RolldownConfig {
3224
- inputOptions?: RolldownInputOptions;
3225
- outputOptions?: RolldownOutputOptions;
3226
- }
3227
- interface RolldownInputOptions {
3228
- context?: string;
3229
- moduleContext?: ((id: string) => string) | {
3230
- [id: string]: string;
3231
- };
3232
3338
  treeshake?: boolean;
3233
- maxParallelFileOps?: number;
3234
3339
  external?: (string | RegExp)[] | string | RegExp | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | undefined);
3235
3340
  }
3236
- interface RolldownOutputOptions {
3237
- globals?: {
3238
- [name: string]: string;
3239
- } | ((name: string) => string);
3240
- }
3241
3341
  /**
3242
3342
  * This sets the log level hierarchy for our terminal logger, ranging from
3243
3343
  * most to least verbose.
@@ -3302,57 +3402,91 @@ interface LoggerTimeSpan {
3302
3402
  duration(): number;
3303
3403
  finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
3304
3404
  }
3305
- interface OutputTargetDist extends OutputTargetValidationConfig {
3306
- type: 'dist';
3405
+ /**
3406
+ * Output target for generating lazy-loaded component bundles with a loader infrastructure.
3407
+ * This creates an optimized distribution for CDN usage and applications that benefit from
3408
+ * lazy-loading components on demand.
3409
+ *
3410
+ * Formerly known as 'dist' in v4.
3411
+ *
3412
+ * @example
3413
+ * ```typescript
3414
+ * {
3415
+ * type: 'loader-bundle',
3416
+ * dir: 'dist/loader-bundle'
3417
+ * }
3418
+ * ```
3419
+ */
3420
+ interface OutputTargetLoaderBundle extends OutputTargetBaseNext {
3421
+ type: 'loader-bundle';
3422
+ /**
3423
+ * Directory where lazy-loaded bundles will be written.
3424
+ * @default '' (root of output directory)
3425
+ */
3307
3426
  buildDir?: string;
3308
- collectionDir?: string | null;
3427
+ copy?: CopyTask[];
3428
+ empty?: boolean;
3309
3429
  /**
3310
- * When `true` this flag will transform aliased import paths defined in
3311
- * a project's `tsconfig.json` to relative import paths in the compiled output's
3312
- * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
3313
- *
3314
- * Paths will be left in aliased format if `false`.
3430
+ * Whether to generate CommonJS (CJS) bundles.
3315
3431
  *
3316
- * @example
3317
- * // tsconfig.json
3318
- * {
3319
- * paths: {
3320
- * "@utils/*": ['/src/utils/*']
3321
- * }
3322
- * }
3432
+ * When `true`, generates CJS output in `cjs/` subdirectory.
3433
+ * When `false` (default in v5+), only ESM bundles are generated.
3323
3434
  *
3324
- * // Source file
3325
- * import * as dateUtils from '@utils/date-utils';
3326
- * // Output file
3327
- * import * as dateUtils from '../utils/date-utils';
3435
+ * @default false
3328
3436
  */
3329
- transformAliasedImportPathsInCollection?: boolean | null;
3330
- typesDir?: string;
3437
+ cjs?: boolean;
3331
3438
  /**
3332
- * Provide a custom path for the ESM loader directory, containing files you can import
3439
+ * Custom path for the loader directory; files you can import
3333
3440
  * in an initiation script within your application to register all your components for
3334
3441
  * lazy loading.
3335
3442
  *
3336
- * @default /dist/loader
3443
+ * @default 'loader' (relative to output directory)
3337
3444
  */
3338
- esmLoaderPath?: string;
3339
- copy?: CopyTask[];
3340
- empty?: boolean;
3445
+ loaderPath?: string;
3341
3446
  /**
3342
- * Whether to generate CommonJS (CJS) bundles.
3447
+ * Hash the filenames of generated chunks based on their content.
3448
+ * Enables forever-caching of CDN-served bundles.
3343
3449
  *
3344
- * When `true`, generates CJS output in `dist/cjs/` and `dist/index.cjs.js`.
3345
- * When `false` (default in v5+), only ESM bundles are generated.
3450
+ * @default true in production, false in dev mode
3451
+ */
3452
+ hashFileNames?: boolean;
3453
+ /**
3454
+ * Number of characters to use for the content hash in filenames.
3455
+ *
3456
+ * @default 8
3457
+ */
3458
+ hashedFileNameLength?: number;
3459
+ /**
3460
+ * When `true`, marks `@stencil/core` as an external dependency in the bundler (ESM/CJS)
3461
+ * distribution output. Consumers must provide `@stencil/core` themselves.
3462
+ *
3463
+ * Has no effect on the browser/CDN build - the runtime is always bundled there.
3346
3464
  *
3347
3465
  * @default false
3348
3466
  */
3349
- cjs?: boolean;
3467
+ externalRuntime?: boolean;
3350
3468
  }
3351
- interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3352
- type: 'dist-collection';
3469
+ /**
3470
+ * Output target for generating Stencil component source for downstream re-bundling.
3471
+ * This output contains transpiled source code, component metadata, and configuration
3472
+ * that downstream Stencil projects can re-compile and bundle.
3473
+ *
3474
+ * Formerly 'dist-collection' sub-output in v4, now a first-class output target in v5.
3475
+ *
3476
+ * In production builds, this output is auto-generated unless explicitly configured.
3477
+ *
3478
+ * @example
3479
+ * ```typescript
3480
+ * {
3481
+ * type: 'collection',
3482
+ * dir: 'dist/collection',
3483
+ * transformAliasedImportPaths: true
3484
+ * }
3485
+ * ```
3486
+ */
3487
+ interface OutputTargetCollection extends OutputTargetBaseNext {
3488
+ type: 'collection';
3353
3489
  empty?: boolean;
3354
- dir: string;
3355
- collectionDir: string;
3356
3490
  /**
3357
3491
  * When `true` this flag will transform aliased import paths defined in
3358
3492
  * a project's `tsconfig.json` to relative import paths in the compiled output.
@@ -3374,10 +3508,25 @@ interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3374
3508
  */
3375
3509
  transformAliasedImportPaths?: boolean | null;
3376
3510
  }
3377
- interface OutputTargetDistTypes extends OutputTargetValidationConfig {
3378
- type: 'dist-types';
3379
- dir: string;
3380
- typesDir: string;
3511
+ /**
3512
+ * Output target for generating TypeScript type definitions (.d.ts files).
3513
+ *
3514
+ * Formerly a sub-output of 'dist' and 'dist-custom-elements' in v4,
3515
+ * now a first-class output target in v5 that can be shared across multiple outputs.
3516
+ *
3517
+ * In production builds, this output is auto-generated unless explicitly configured.
3518
+ *
3519
+ * @example
3520
+ * ```typescript
3521
+ * {
3522
+ * type: 'types',
3523
+ * dir: 'dist/types'
3524
+ * }
3525
+ * ```
3526
+ */
3527
+ interface OutputTargetTypes extends OutputTargetBaseNext {
3528
+ type: 'types';
3529
+ empty?: boolean;
3381
3530
  }
3382
3531
  interface OutputTargetDistLazy extends OutputTargetBase {
3383
3532
  type: 'dist-lazy';
@@ -3387,22 +3536,106 @@ interface OutputTargetDistLazy extends OutputTargetBase {
3387
3536
  isBrowserBuild?: boolean;
3388
3537
  esmIndexFile?: string;
3389
3538
  cjsIndexFile?: string;
3539
+ loaderDir?: string;
3540
+ typesDir?: string;
3390
3541
  empty?: boolean;
3542
+ /** Inherited from parent output target (loader-bundle or www). Only meaningful for browser builds. */
3543
+ hashFileNames?: boolean;
3544
+ /** Inherited from parent output target (loader-bundle or www). */
3545
+ hashedFileNameLength?: number;
3546
+ /** Inherited from loader-bundle. When true, @stencil/core is external in this bundler output. */
3547
+ externalRuntime?: boolean;
3391
3548
  }
3392
- interface OutputTargetDistGlobalStyles extends OutputTargetBase {
3393
- type: 'dist-global-styles';
3394
- file: string;
3549
+ /**
3550
+ * Output target for global styles.
3551
+ * Generates a CSS file from an input stylesheet.
3552
+ *
3553
+ * Can be configured in two ways:
3554
+ * 1. **Implicit** (backwards compat): Set `globalStyle` in the config and this output is auto-generated
3555
+ * 2. **Explicit**: Define this output target with an `input` property
3556
+ *
3557
+ * Multiple `global-style` outputs are supported for building separate CSS bundles.
3558
+ *
3559
+ * @example
3560
+ * ```typescript
3561
+ * // Explicit configuration with custom input/output
3562
+ * {
3563
+ * type: 'global-style',
3564
+ * input: './src/theme.css',
3565
+ * fileName: 'theme.css',
3566
+ * dir: 'dist/assets',
3567
+ * copyToLoaderBrowser: false
3568
+ * }
3569
+ * ```
3570
+ */
3571
+ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
3572
+ type: 'global-style';
3573
+ /**
3574
+ * Path to the input CSS file to compile.
3575
+ * When specified, this takes precedence over the `globalStyle` config option.
3576
+ *
3577
+ * If neither `input` nor `globalStyle` config is set, no CSS will be built.
3578
+ */
3579
+ input?: string;
3580
+ /**
3581
+ * Output filename for the compiled CSS.
3582
+ * @default '{namespace}.css' when using globalStyle config, or basename of input file
3583
+ */
3584
+ fileName?: string;
3585
+ /**
3586
+ * When `true`, also copies the global style CSS to the loader-bundle browser directory
3587
+ * for backwards compatibility with existing CDN consumers who have hardcoded CSS paths.
3588
+ *
3589
+ * @default true
3590
+ */
3591
+ copyToLoaderBrowser?: boolean;
3592
+ /**
3593
+ * Controls whether this global stylesheet is injected into component shadow DOMs
3594
+ * as a constructable stylesheet at runtime.
3595
+ *
3596
+ * - `'none'` (default): Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
3597
+ * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
3598
+ * - `'all'`: Inject in both client and SSR builds
3599
+ *
3600
+ * @default 'none'
3601
+ */
3602
+ inject?: 'none' | 'client' | 'all';
3395
3603
  }
3396
- interface OutputTargetDistLazyLoader extends OutputTargetBase {
3397
- type: 'dist-lazy-loader';
3398
- dir: string;
3399
- esmDir: string;
3400
- cjsDir?: string;
3401
- componentDts: string;
3402
- empty: boolean;
3604
+ /**
3605
+ * Output target for component assets.
3606
+ * Copies all component `assetsDirs` to a unified location.
3607
+ *
3608
+ * auto-generated when components have `assetsDirs` unless explicitly configured.
3609
+ * The output is placed in `dist/assets/` by default and is available to all distribution strategies.
3610
+ *
3611
+ * @example
3612
+ * ```typescript
3613
+ * {
3614
+ * type: 'assets',
3615
+ * dir: 'dist/assets'
3616
+ * }
3617
+ * ```
3618
+ */
3619
+ interface OutputTargetAssets extends OutputTargetBaseNext {
3620
+ type: 'assets';
3403
3621
  }
3404
- interface OutputTargetHydrate extends OutputTargetBase {
3405
- type: 'dist-hydrate-script';
3622
+ /**
3623
+ * Output target for server-side rendering (SSR) and hydration.
3624
+ * Generates a script that can be used for SSR and static site generation (prerendering).
3625
+ *
3626
+ * Formerly known as 'dist-hydrate-script' in v4.
3627
+ *
3628
+ * @example
3629
+ * ```typescript
3630
+ * {
3631
+ * type: 'ssr',
3632
+ * dir: 'dist/ssr',
3633
+ * minify: true
3634
+ * }
3635
+ * ```
3636
+ */
3637
+ interface OutputTargetSsr extends OutputTargetBase {
3638
+ type: 'ssr';
3406
3639
  dir?: string;
3407
3640
  /**
3408
3641
  * Module IDs that should not be bundled into the script.
@@ -3422,6 +3655,13 @@ interface OutputTargetHydrate extends OutputTargetBase {
3422
3655
  */
3423
3656
  cjs?: boolean;
3424
3657
  }
3658
+ interface OutputTargetSsrWasm extends OutputTargetBase {
3659
+ type: 'ssr-wasm';
3660
+ /** Output directory. @default 'dist/ssr-wasm' */
3661
+ dir?: string;
3662
+ empty?: boolean;
3663
+ minify?: boolean;
3664
+ }
3425
3665
  interface OutputTargetCustom extends OutputTargetBase {
3426
3666
  type: 'custom';
3427
3667
  name: string;
@@ -3523,14 +3763,13 @@ interface OutputTargetStats extends OutputTargetBase {
3523
3763
  type: 'stats';
3524
3764
  file?: string;
3525
3765
  }
3526
- interface OutputTargetBaseNext {
3527
- type: string;
3766
+ interface OutputTargetBaseNext extends OutputTargetBase {
3528
3767
  dir?: string;
3529
3768
  }
3530
3769
  /**
3531
3770
  * The collection of valid export behaviors.
3532
3771
  * Used to generate a type for typed configs as well as output target validation
3533
- * for the `dist-custom-elements` output target.
3772
+ * for the `standalone` output target.
3534
3773
  *
3535
3774
  * Adding a value to this const array will automatically add it as a valid option on the
3536
3775
  * output target configuration for `customElementsExportBehavior`.
@@ -3539,8 +3778,7 @@ interface OutputTargetBaseNext {
3539
3778
  * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
3540
3779
  * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
3541
3780
  * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
3542
- * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
3543
- * from `dist-custom-elements-bundle` to `dist-custom-elements`.
3781
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory.
3544
3782
  * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
3545
3783
  */
3546
3784
  declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
@@ -3549,23 +3787,40 @@ declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-de
3549
3787
  * This is used on the output target config for intellisense in typed configs.
3550
3788
  */
3551
3789
  type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
3552
- interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3553
- type: 'dist-custom-elements';
3790
+ /**
3791
+ * Output target for generating standalone component modules.
3792
+ * Each component is output as an individual ES module that can be directly imported.
3793
+ *
3794
+ * This output target is ideal for npm consumption and tree-shaking, as consumers
3795
+ * can import only the components they need.
3796
+ *
3797
+ * Formerly known as 'dist-custom-elements' in v4.
3798
+ *
3799
+ * @example
3800
+ * ```typescript
3801
+ * {
3802
+ * type: 'standalone',
3803
+ * dir: 'dist/standalone',
3804
+ * externalRuntime: true,
3805
+ * autoLoader: true
3806
+ * }
3807
+ * ```
3808
+ */
3809
+ interface OutputTargetStandalone extends OutputTargetBaseNext {
3810
+ type: 'standalone';
3554
3811
  empty?: boolean;
3555
3812
  /**
3556
3813
  * Triggers the following behaviors when enabled:
3557
3814
  * 1. All `@stencil/core/*` module references are treated as external during bundling.
3558
3815
  * 2. File names are not hashed.
3559
3816
  * 3. File minification will follow the behavior defined at the root of the Stencil config.
3817
+ *
3818
+ * @default false
3560
3819
  */
3561
3820
  externalRuntime?: boolean;
3562
3821
  copy?: CopyTask[];
3563
3822
  includeGlobalScripts?: boolean;
3564
3823
  minify?: boolean;
3565
- /**
3566
- * Enables the generation of type definition files for the output target.
3567
- */
3568
- generateTypeDeclarations?: boolean;
3569
3824
  /**
3570
3825
  * Define the export/definition behavior for the output target's generated output.
3571
3826
  * This controls if/how custom elements will be defined or where components will be exported from.
@@ -3576,6 +3831,8 @@ interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3576
3831
  * Generate an auto-loader script that uses MutationObserver to lazily load
3577
3832
  * and define custom elements as they appear in the DOM.
3578
3833
  *
3834
+ * @default true
3835
+ *
3579
3836
  * When set to `true`, generates a `loader.js` file that auto-starts on import.
3580
3837
  * Can also be configured with an object for more control:
3581
3838
  * - `fileName`: Custom filename for the loader (default: 'loader.js')
@@ -3615,27 +3872,45 @@ interface OutputTargetBase {
3615
3872
  * A unique string to differentiate one output target from another
3616
3873
  */
3617
3874
  type: string;
3875
+ /**
3876
+ * When `true`, this output target will be skipped during development builds (`--dev`).
3877
+ * This improves dev build times by not generating production-only artifacts.
3878
+ *
3879
+ * Defaults vary by output target type:
3880
+ * - `loader-bundle`: `false` (always builds)
3881
+ * - `standalone`: `true` (skips in dev)
3882
+ * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
3883
+ * - `docs-*`: `true` (skips in dev)
3884
+ * - `custom`: `true` (skips in dev)
3885
+ * - `www`, `copy`, `stats`: `false` (always runs)
3886
+ */
3887
+ skipInDev?: boolean;
3618
3888
  }
3619
- /**
3620
- * Output targets that can have validation for common `package.json` field values
3621
- * (module, types, etc.). This allows them to be marked for validation in a project's Stencil config.
3622
- */
3623
- interface OutputTargetValidationConfig extends OutputTargetBaseNext {
3624
- isPrimaryPackageOutputTarget?: boolean;
3625
- }
3626
- type EligiblePrimaryPackageOutputTarget = OutputTargetDist | OutputTargetDistCustomElements | OutputTargetDistCollection | OutputTargetDistTypes;
3627
- type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
3889
+ type OutputTargetBuild = OutputTargetCollection | OutputTargetDistLazy;
3628
3890
  interface OutputTargetCopy extends OutputTargetBase {
3629
3891
  type: 'copy';
3630
3892
  dir: string;
3631
3893
  copy?: CopyTask[];
3632
- copyAssets?: 'collection' | 'dist';
3633
3894
  }
3634
3895
  interface OutputTargetWww extends OutputTargetBase {
3635
3896
  /**
3636
3897
  * Webapp output target.
3637
3898
  */
3638
3899
  type: 'www';
3900
+ /**
3901
+ * Choose how components are bundled for the www output.
3902
+ *
3903
+ * - `'loader'` (default): Uses the loader-bundle architecture with chunk
3904
+ * splitting and a loader infrastructure. Best for production apps with many
3905
+ * components where you want optimal loading performance.
3906
+ *
3907
+ * - `'standalone'`: Uses standalone component modules with an auto-loader that
3908
+ * uses MutationObserver to dynamically import components as they appear in
3909
+ * the DOM. Simpler architecture, easier debugging, one module per component.
3910
+ *
3911
+ * Default: `'loader'`
3912
+ */
3913
+ bundleMode?: 'loader' | 'standalone';
3639
3914
  /**
3640
3915
  * The directory to write the app's JavaScript and CSS build
3641
3916
  * files to. The default is to place this directory as a child
@@ -3682,7 +3957,7 @@ interface OutputTargetWww extends OutputTargetBase {
3682
3957
  * Path to an external node module which has exports of the prerender config object.
3683
3958
  * ```
3684
3959
  * module.exports = {
3685
- * afterHydrate(document, url) {
3960
+ * afterSsr(document, url) {
3686
3961
  * document.title = `URL: ${url.href}`;
3687
3962
  * }
3688
3963
  * }
@@ -3697,8 +3972,21 @@ interface OutputTargetWww extends OutputTargetBase {
3697
3972
  */
3698
3973
  serviceWorker?: ServiceWorkerConfig | null | false;
3699
3974
  appDir?: string;
3975
+ /**
3976
+ * Hash the filenames of generated chunks based on their content.
3977
+ * Enables forever-caching of CDN-served bundles.
3978
+ *
3979
+ * @default true in production, false in dev mode
3980
+ */
3981
+ hashFileNames?: boolean;
3982
+ /**
3983
+ * Number of characters to use for the content hash in filenames.
3984
+ *
3985
+ * @default 8
3986
+ */
3987
+ hashedFileNameLength?: number;
3700
3988
  }
3701
- type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
3989
+ type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetSsrWasm | OutputTargetCollection | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetStats;
3702
3990
  /**
3703
3991
  * Our custom configuration interface for generated caching Service Workers
3704
3992
  * using the Workbox library (see https://developer.chrome.com/docs/workbox/).
@@ -3793,24 +4081,13 @@ interface WorkerOptions {
3793
4081
  maxConcurrentTasksPerWorker?: number;
3794
4082
  logger?: Logger;
3795
4083
  }
3796
- interface RolldownInterface {
3797
- rolldown: {
3798
- (config: any): Promise<any>;
3799
- };
3800
- plugins: {
3801
- nodeResolve(opts: any): any;
3802
- replace(opts: any): any;
3803
- commonjs(opts: any): any;
3804
- json(): any;
3805
- };
3806
- }
3807
4084
  interface ResolveModuleOptions {
3808
4085
  manuallyResolve?: boolean;
3809
4086
  packageJson?: boolean;
3810
4087
  }
3811
4088
  interface PrerenderStartOptions {
3812
4089
  buildId?: string;
3813
- hydrateAppFilePath?: string;
4090
+ ssrAppFilePath?: string;
3814
4091
  componentGraph?: BuildResultsComponentGraph;
3815
4092
  srcIndexHtmlPath?: string;
3816
4093
  }
@@ -3885,6 +4162,18 @@ interface Compiler {
3885
4162
  createWatcher(): Promise<CompilerWatcher>;
3886
4163
  destroy(): Promise<void>;
3887
4164
  sys: CompilerSystem;
4165
+ /**
4166
+ * @internal - Testing only. Access to the in-memory filesystem
4167
+ */
4168
+ fs?: InMemoryFileSystem;
4169
+ /**
4170
+ * @internal - Testing only. Access to the validated configuration
4171
+ */
4172
+ config?: ValidatedConfig;
4173
+ /**
4174
+ * @internal - Testing only. Access to the compiler context
4175
+ */
4176
+ compilerCtx?: CompilerCtx;
3888
4177
  }
3889
4178
  interface CompilerWatcher extends BuildOnEvents {
3890
4179
  start: () => Promise<WatcherCloseResults>;
@@ -3925,7 +4214,7 @@ interface TranspileOptions {
3925
4214
  componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
3926
4215
  /**
3927
4216
  * The actual internal import path for any `@stencil/core` imports.
3928
- * Default is `@stencil/core/runtime/client`.
4217
+ * Default is `@stencil/core/runtime/client/standalone`.
3929
4218
  */
3930
4219
  coreImportPath?: string;
3931
4220
  /**
@@ -4082,4 +4371,4 @@ interface CliInitOptions {
4082
4371
  sys: CompilerSystem;
4083
4372
  }
4084
4373
  //#endregion
4085
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, EligiblePrimaryPackageOutputTarget, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCopy, OutputTargetCustom, OutputTargetDist, OutputTargetDistCollection, OutputTargetDistCustomElements, OutputTargetDistGlobalStyles, OutputTargetDistLazy, OutputTargetDistLazyLoader, OutputTargetDistTypes, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetHydrate, OutputTargetStats, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, RolldownInputOptions, RolldownInterface, RolldownOutputOptions, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };
4374
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };