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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +94 -0
  2. package/bin/stencil.mjs +1 -1
  3. package/dist/app-data/index.d.ts +2 -0
  4. package/dist/{runtime/app-data → app-data}/index.js +23 -15
  5. package/dist/{runtime/app-globals → app-globals}/index.js +1 -2
  6. package/dist/client-BMtGBEQV.mjs +2498 -0
  7. package/dist/compiler/browser.d.ts +1573 -0
  8. package/dist/compiler/browser.js +16998 -0
  9. package/dist/compiler/index.d.mts +284 -7
  10. package/dist/compiler/index.mjs +3 -9
  11. package/dist/compiler/utils/index.d.mts +272 -3
  12. package/dist/compiler/utils/index.mjs +4 -5
  13. package/dist/{transpile-CJQcQEVa.mjs → compiler-C_Y38j4m.mjs} +20984 -15554
  14. package/dist/declarations/stencil-ext-modules.d.ts +8 -8
  15. package/dist/declarations/stencil-public-compiler.d.ts +1016 -840
  16. package/dist/declarations/stencil-public-compiler.js +3 -5
  17. package/dist/declarations/stencil-public-docs.d.ts +441 -376
  18. package/dist/declarations/stencil-public-docs.js +0 -0
  19. package/dist/declarations/stencil-public-runtime.d.ts +361 -113
  20. package/dist/fragment-Di1hWOC8.mjs +4 -0
  21. package/dist/helpers-pTCZhNi0.mjs +529 -0
  22. package/dist/{index-szczUd2l.d.mts → index-CFiy6MZ3.d.mts} +1471 -2044
  23. package/dist/index-CViiWNQ9.d.mts +104 -0
  24. package/dist/{stencil-private-Cgcr414u.d.ts → index-XQHZl0MW.d.ts} +308 -114
  25. package/dist/index.d.mts +14 -2
  26. package/dist/index.mjs +171 -4
  27. package/dist/jsx-runtime.d.mts +24 -0
  28. package/dist/jsx-runtime.mjs +3 -0
  29. package/dist/mock-doc.mjs +2 -3
  30. package/dist/{node-sys-BGURUNOZ.mjs → node-Bkq8vRnu.mjs} +176 -197
  31. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  32. package/dist/{client-DR9zhmKG.mjs → runtime/client/lazy.js} +3794 -2659
  33. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +516 -227
  34. package/dist/runtime/client/{index.js → runtime.js} +3596 -2857
  35. package/dist/runtime/index.d.ts +90 -72
  36. package/dist/runtime/index.js +3528 -2897
  37. package/dist/runtime/server/index.d.mts +243 -219
  38. package/dist/runtime/server/index.mjs +3770 -3352
  39. package/dist/runtime/server/runner.d.mts +114 -47
  40. package/dist/runtime/server/runner.mjs +12710 -763
  41. package/dist/signals/index.d.ts +58 -0
  42. package/dist/signals/index.js +182 -0
  43. package/dist/sys/node/index.d.mts +1 -3
  44. package/dist/sys/node/index.mjs +2 -7
  45. package/dist/sys/node/worker.d.mts +1 -1
  46. package/dist/sys/node/worker.mjs +3 -12
  47. package/dist/testing/index.d.mts +4763 -12
  48. package/dist/testing/index.mjs +7945 -618
  49. package/dist/util-CP6-333M.mjs +731 -0
  50. package/dist/validation-C1mr0klL.mjs +825 -0
  51. package/package.json +91 -59
  52. package/dist/chunk-ClPoSABd.mjs +0 -21
  53. package/dist/index-Bxo2jCf6.d.mts +0 -77
  54. package/dist/runtime/app-data/index.d.ts +0 -30
  55. package/dist/serialize-BJvhE9aQ.mjs +0 -775
  56. package/dist/validation-BdcPruW_.mjs +0 -1451
  57. /package/{LICENSE.md → LICENSE} +0 -0
  58. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import { ListenTargetOptions, ResolutionHandler } from "./stencil-public-runtime.js";
2
-
2
+ import { InputOptions, Plugin as Plugin$1, SourceMap } from "rolldown";
3
+ import "typescript";
3
4
  //#region src/utils/result.d.ts
4
5
  /**
5
6
  * A Result wraps up a success state and a failure state, allowing you to
@@ -46,15 +47,6 @@ type Err<T> = {
46
47
  isErr: true;
47
48
  value: T;
48
49
  };
49
- /**
50
- * Create an `Ok` given a value. This doesn't do any checking that the value is
51
- * 'ok-ish' since doing so would make an undue assumption about what is 'ok'.
52
- * Instead, this trusts the user to determine, at the call site, whether
53
- * something is `ok()` or `err()`.
54
- *
55
- * @param value the value to wrap up in an `Ok`
56
- * @returns an Ok wrapping the value
57
- */
58
50
  //#endregion
59
51
  //#region src/compiler/sys/in-memory-fs.d.ts
60
52
  /**
@@ -231,10 +223,6 @@ declare const createInMemoryFs: (sys: CompilerSystem) => {
231
223
  * `[ source, destination ]`
232
224
  */
233
225
  type FileCopyTuple = [string, string];
234
- /**
235
- * Collected instructions for all pending filesystem operations saved
236
- * to the in-memory filesystem.
237
- */
238
226
  /**
239
227
  * Results from committing pending filesystem operations
240
228
  */
@@ -245,14 +233,6 @@ interface FsCommitResults {
245
233
  dirsDeleted: string[];
246
234
  dirsAdded: string[];
247
235
  }
248
- /**
249
- * Given the current state of the in-memory proxy filesystem, collect all of
250
- * the changes that need to be made in order to commit the currently-pending
251
- * operations (e.g. write, copy, delete) to the OS filesystem.
252
- *
253
- * @param items the storage data structure for the in-memory FS cache
254
- * @returns a collection of all the operations that need to be done
255
- */
256
236
  //#endregion
257
237
  //#region src/declarations/stencil-public-docs.d.ts
258
238
  /**
@@ -275,6 +255,13 @@ interface JsonDocs {
275
255
  * The metadata for the JSDocs for each component in a Stencil project
276
256
  */
277
257
  components: JsonDocsComponent[];
258
+ /**
259
+ * Project-level usage content, collected from markdown files in a `usage`
260
+ * directory at the project's {@link Config.srcDir} root (as opposed to
261
+ * per-component usage content, which lives in {@link JsonDocsComponent.usage}).
262
+ * Keyed by file name (without extension), same shape as component usage.
263
+ */
264
+ usage?: JsonDocsUsage;
278
265
  /**
279
266
  * The timestamp at which the metadata was generated, in the format YYYY-MM-DDThh:mm:ss
280
267
  */
@@ -407,6 +394,11 @@ interface JsonDocsComponent {
407
394
  * A deprecation reason/description found following a `@deprecated` tag
408
395
  */
409
396
  deprecation?: string;
397
+ /**
398
+ * `true` if this is a "CSS-only component"
399
+ * discovered in .css file via `@component`-marked JSDoc block
400
+ */
401
+ cssOnly?: boolean;
410
402
  }
411
403
  interface JsonDocsDependencyGraph {
412
404
  [tagName: string]: string[];
@@ -566,6 +558,16 @@ interface JsonDocsStyle {
566
558
  * The annotation used in the JSDoc of the style (e.g. `@prop`)
567
559
  */
568
560
  annotation: string;
561
+ /**
562
+ * The CSS `syntax` descriptor for a custom property, if it was registered via a native
563
+ * `@property` at-rule (e.g. `"<length>"`).
564
+ */
565
+ syntax?: string;
566
+ /**
567
+ * The `initial-value` descriptor for a custom property, if it was registered via a native
568
+ * `@property` at-rule.
569
+ */
570
+ default?: string;
569
571
  /**
570
572
  * The mode associated with the style
571
573
  */
@@ -652,10 +654,20 @@ interface StyleDoc {
652
654
  * The Stencil style-mode that is associated with this property.
653
655
  */
654
656
  mode: string | undefined;
657
+ /**
658
+ * The CSS `syntax` descriptor, if this property was registered via a native `@property` at-rule.
659
+ */
660
+ syntax?: string;
661
+ /**
662
+ * The `initial-value` descriptor, if this property was registered via a native `@property` at-rule.
663
+ */
664
+ default?: string;
655
665
  }
656
666
  //#endregion
657
667
  //#region src/declarations/stencil-private.d.ts
658
- interface SourceMap {
668
+ /** Build-time virtual `@import`s a `global-style` input can use to place Stencil-generated CSS. */
669
+ type StencilVirtualImport = 'stencil-hydrate' | 'stencil-component-globals' | 'stencil-css-components';
670
+ interface SourceMap$1 {
659
671
  file: string;
660
672
  mappings: string;
661
673
  names: string[];
@@ -671,12 +683,114 @@ interface PrintLine {
671
683
  errorCharStart: number;
672
684
  errorLength?: number;
673
685
  }
686
+ interface BuildFeatures {
687
+ style: boolean;
688
+ mode: boolean;
689
+ formAssociated: boolean;
690
+ shadowDom: boolean;
691
+ shadowDelegatesFocus: boolean;
692
+ shadowModeClosed: boolean;
693
+ shadowSlotAssignmentManual: boolean;
694
+ shadowClonable: boolean;
695
+ shadowSerializable: boolean;
696
+ shadowReferenceTarget: boolean;
697
+ scoped: boolean;
698
+ /**
699
+ * Every component has a render function
700
+ */
701
+ allRenderFn: boolean;
702
+ /**
703
+ * At least one component has a render function
704
+ */
705
+ hasRenderFn: boolean;
706
+ vdomRender: boolean;
707
+ vdomAttribute: boolean;
708
+ vdomClass: boolean;
709
+ vdomFunctional: boolean;
710
+ vdomKey: boolean;
711
+ vdomListener: boolean;
712
+ vdomPropOrAttr: boolean;
713
+ /** True when at least one component uses the explicit `attr:`/`prop:` JSX prefix. */
714
+ vdomPropOrAttrPrefix: boolean;
715
+ vdomRef: boolean;
716
+ vdomStyle: boolean;
717
+ vdomText: boolean;
718
+ vdomXlink: boolean;
719
+ vdomSignals: boolean;
720
+ slotRelocation: boolean;
721
+ patchAll: boolean;
722
+ patchChildren: boolean;
723
+ patchClone: boolean;
724
+ patchInsert: boolean;
725
+ slot: boolean;
726
+ svg: boolean;
727
+ element: boolean;
728
+ event: boolean;
729
+ hostListener: boolean;
730
+ hostListenerTargetWindow: boolean;
731
+ hostListenerTargetDocument: boolean;
732
+ hostListenerTargetBody: boolean;
733
+ hostListenerTarget: boolean;
734
+ method: boolean;
735
+ prop: boolean;
736
+ propChangeCallback: boolean;
737
+ propMutable: boolean;
738
+ state: boolean;
739
+ member: boolean;
740
+ updatable: boolean;
741
+ propBoolean: boolean;
742
+ propNumber: boolean;
743
+ propString: boolean;
744
+ serializer: boolean;
745
+ deserializer: boolean;
746
+ lifecycle: boolean;
747
+ asyncLoading: boolean;
748
+ observeAttribute: boolean;
749
+ reflect: boolean;
750
+ taskQueue: boolean;
751
+ }
752
+ interface BuildConditionals extends Partial<BuildFeatures> {
753
+ hotModuleReplacement?: boolean;
754
+ isDebug?: boolean;
755
+ isTesting?: boolean;
756
+ isDev?: boolean;
757
+ devTools?: boolean;
758
+ invisiblePrehydration?: boolean;
759
+ hydrateServerSide?: boolean;
760
+ hydrateClientSide?: boolean;
761
+ lifecycleDOMEvents?: boolean;
762
+ cssAnnotations?: boolean;
763
+ lazyLoad?: boolean;
764
+ profile?: boolean;
765
+ constructableCSS?: boolean;
766
+ /** True when `compat.lightDomPatches === true` - enables `applyLightDomPatches` shortcut. */
767
+ lightDomPatches?: boolean;
768
+ /** Patch `childNodes`/`children` getters on light-dom slotted components. */
769
+ slotChildNodes?: boolean;
770
+ /** Patch `cloneNode()` on light-dom slotted components. */
771
+ slotCloneNode?: boolean;
772
+ /** Patch `appendChild`/`insertBefore`/`removeChild` on light-dom slotted components. */
773
+ slotDomMutations?: boolean;
774
+ /** Patch `textContent` on light-dom slotted components. */
775
+ slotTextContent?: boolean;
776
+ hydratedAttribute?: boolean;
777
+ hydratedClass?: boolean;
778
+ hydratedSelectorName?: string;
779
+ /** True when a global-style input contains `@import "stencil-hydrate"` - suppresses dynamic style injection in the loader. */
780
+ staticHydrationStyles?: boolean;
781
+ initializeNextTick?: boolean;
782
+ asyncQueue?: boolean;
783
+ additionalTagTransformers?: boolean | 'prod';
784
+ signalBacking?: boolean;
785
+ /** True when JSX signal bypass is active - text nodes and attributes backed by Signal objects update the DOM directly. Auto-enabled when `signalBacking: true`. */
786
+ vdomSignals?: boolean;
787
+ }
674
788
  type ModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd' | 'commonjs' | 'esm' | 'module' | 'systemjs';
675
- interface RollupResultModule {
789
+ interface RolldownResultModule {
676
790
  id: string;
677
791
  }
678
- interface RollupResults {
679
- modules: RollupResultModule[];
792
+ interface RolldownResults {
793
+ modules: RolldownResultModule[];
680
794
  }
681
795
  interface BuildCtx {
682
796
  buildId: number;
@@ -690,10 +804,9 @@ interface BuildCtx {
690
804
  compilerCtx: CompilerCtx;
691
805
  esmBrowserComponentBundle: ReadonlyArray<BundleModule>;
692
806
  esmComponentBundle: ReadonlyArray<BundleModule>;
693
- es5ComponentBundle: ReadonlyArray<BundleModule>;
694
- systemComponentBundle: ReadonlyArray<BundleModule>;
695
807
  commonJsComponentBundle: ReadonlyArray<BundleModule>;
696
808
  components: ComponentCompilerMeta[];
809
+ cssOnlyComponents: ComponentCompilerMeta[];
697
810
  componentGraph: Map<string, string[]>;
698
811
  config: ValidatedConfig;
699
812
  createTimeSpan(msg: string, debug?: boolean): LoggerTimeSpan;
@@ -718,19 +831,21 @@ interface BuildCtx {
718
831
  hasScriptChanges: boolean;
719
832
  hasStyleChanges: boolean;
720
833
  hasWarning: boolean;
721
- hydrateAppFilePath: string;
834
+ ssrAppFilePath: string;
722
835
  indexBuildCount: number;
723
836
  indexDoc: Document;
837
+ /** All non-entry HTML files found in srcDir, keyed by path relative to srcDir */
838
+ htmlDocs: Map<string, Document>;
724
839
  isRebuild: boolean;
725
840
  /**
726
841
  * A collection of Stencil's intermediate representation of components, tied to the current build
727
842
  */
728
843
  moduleFiles: Module[];
729
- packageJson: PackageJsonData;
844
+ packageJson: PackageJsonData | null;
730
845
  pendingCopyTasks: Promise<CopyResults>[];
731
846
  progress(task: BuildTask): void;
732
847
  requiresFullBuild: boolean;
733
- rollupResults?: RollupResults;
848
+ rolldownResults?: RolldownResults;
734
849
  scriptsAdded: string[];
735
850
  scriptsDeleted: string[];
736
851
  startTime: number;
@@ -740,6 +855,9 @@ interface BuildCtx {
740
855
  */
741
856
  stylesPromise: Promise<string>;
742
857
  stylesUpdated: BuildStyleUpdate[];
858
+ globalStylesUpdated: BuildGlobalStyleLinkUpdate[];
859
+ /** Absolute path of the generated `{fsNamespace}.css`, when this build emitted one */
860
+ stencilCssFile?: string;
743
861
  timeSpan: LoggerTimeSpan;
744
862
  timestamp: string;
745
863
  transpileBuildCount: number;
@@ -752,6 +870,14 @@ interface BuildStyleUpdate {
752
870
  styleText: string;
753
871
  styleMode: string;
754
872
  }
873
+ /**
874
+ * A live-reload update for a `global-style` output target's CSS, matched on
875
+ * the client by `fileName` against the `<link>`
876
+ */
877
+ interface BuildGlobalStyleLinkUpdate {
878
+ fileName: string;
879
+ styleText: string;
880
+ }
755
881
  type BuildTask = any;
756
882
  interface CompilerBuildStats {
757
883
  timestamp: string;
@@ -770,20 +896,15 @@ interface CompilerBuildStats {
770
896
  options: {
771
897
  minifyJs: boolean;
772
898
  minifyCss: boolean;
773
- hashFileNames: boolean;
774
- hashedFileNameLength: number;
775
- buildEs5: boolean | 'prod';
776
899
  };
777
900
  formats: {
778
901
  esmBrowser: ReadonlyArray<CompilerBuildStatBundle>;
779
902
  esm: ReadonlyArray<CompilerBuildStatBundle>;
780
- es5: ReadonlyArray<CompilerBuildStatBundle>;
781
- system: ReadonlyArray<CompilerBuildStatBundle>;
782
903
  commonjs: ReadonlyArray<CompilerBuildStatBundle>;
783
904
  };
784
905
  components: BuildComponent[];
785
906
  entries: EntryModule[];
786
- rollupResults: RollupResults;
907
+ rolldownResults: RolldownResults;
787
908
  sourceGraph?: BuildSourceGraph;
788
909
  componentGraph: BuildResultsComponentGraph;
789
910
  collections: CompilerBuildStatCollection[];
@@ -809,7 +930,7 @@ interface BuildComponent {
809
930
  dependencyOf?: string[];
810
931
  dependencies?: string[];
811
932
  }
812
- interface RollupChunkResult {
933
+ interface RolldownChunkResult {
813
934
  type: 'chunk';
814
935
  entryKey: string;
815
936
  fileName: string;
@@ -821,21 +942,11 @@ interface RollupChunkResult {
821
942
  isBrowserLoader: boolean;
822
943
  imports: string[];
823
944
  moduleFormat: ModuleFormat;
824
- map?: RollupSourceMap;
825
- }
826
- interface RollupSourceMap {
827
- file: string;
828
- mappings: string;
829
- names: string[];
830
- sources: string[];
831
- sourcesContent: string[];
832
- version: number;
833
- toString(): string;
834
- toUrl(): string;
945
+ map?: SourceMap;
835
946
  }
836
947
  interface BundleModule {
837
948
  entryKey: string;
838
- rollupResult: RollupChunkResult;
949
+ rolldownResult: RolldownChunkResult;
839
950
  cmps: ComponentCompilerMeta[];
840
951
  output: BundleModuleOutput;
841
952
  }
@@ -868,12 +979,32 @@ interface CollectionCompilerMeta {
868
979
  bundles?: {
869
980
  components: string[];
870
981
  }[];
982
+ buildFlags?: Partial<BuildConditionals>;
871
983
  }
872
984
  interface CollectionCompilerVersion {
873
985
  name: string;
874
986
  version: string;
875
987
  typescriptVersion?: string;
876
988
  }
989
+ /**
990
+ * A memoized result of the SASS + Lightning CSS transformation for a single stylesheet, keyed by
991
+ * the annotated Rolldown import id (e.g. `/path/to/comp.scss?tag=ion-button&encapsulation=shadow`).
992
+ *
993
+ * Storing this allows all output targets (customElements, lazy, hydrate) that process the same
994
+ * stylesheets to share a single computation instead of repeating it N times.
995
+ */
996
+ interface CssTransformCacheEntry {
997
+ /** Resolved file ID after plugin (SASS) transforms */
998
+ pluginTransformId: string;
999
+ /** CSS source produced by the SASS / plugin pipeline */
1000
+ pluginTransformCode: string;
1001
+ /** File dependencies discovered during the SASS transform (e.g. `@import`-ed partials) */
1002
+ pluginTransformDependencies: string[];
1003
+ /** Diagnostics emitted during the plugin transform pass */
1004
+ pluginTransformDiagnostics: Diagnostic[];
1005
+ /** Full output of the subsequent `transformCssToEsm` call */
1006
+ cssTransformOutput: TransformCssToEsmOutput;
1007
+ }
877
1008
  interface CompilerCtx {
878
1009
  version: number;
879
1010
  activeBuildId: number;
@@ -886,7 +1017,14 @@ interface CompilerCtx {
886
1017
  addWatchFile: (path: string) => void;
887
1018
  cache: Cache;
888
1019
  cssModuleImports: Map<string, string[]>;
889
- cachedGlobalStyle: string;
1020
+ /** Cache of built global styles, keyed by input file path */
1021
+ globalStyleCache: Map<string, string>;
1022
+ /** Cache of discovered CSS-only components from the last scan, keyed by absolute .css file path */
1023
+ cssOnlyComponentsCache: Map<string, ComponentCompilerMeta[]>;
1024
+ /** Contents of the last auto-placed `stencil-*` CSS, used to detect changes for HMR */
1025
+ stencilCss?: string;
1026
+ /** Virtual imports found in each built global style (post-preprocessing), keyed by input path */
1027
+ globalStyleVirtualImports: Map<string, Set<StencilVirtualImport>>;
890
1028
  collections: CollectionCompilerMeta[];
891
1029
  compilerOptions: any;
892
1030
  events: BuildEvents;
@@ -900,14 +1038,40 @@ interface CompilerCtx {
900
1038
  moduleMap: ModuleMap;
901
1039
  nodeMap: NodeMap;
902
1040
  resolvedCollections: Set<string>;
903
- rollupCacheHydrate: any;
904
- rollupCacheLazy: any;
905
- rollupCacheNative: any;
1041
+ rolldownCacheSsr: any;
1042
+ rolldownCacheLazy: any;
1043
+ rolldownCacheNative: any;
906
1044
  styleModeNames: Set<string>;
907
1045
  changedModules: Set<string>;
908
1046
  changedFiles: Set<string>;
909
1047
  worker?: CompilerWorkerContext;
910
- rollupCache: Map<string, any>;
1048
+ rolldownCache: Map<string, any>;
1049
+ /**
1050
+ * Cross-build cache for {@link ts.transpileModule} results.
1051
+ * Keyed by `"${bundleId}:${normalizedFilePath}"`. Invalidated for any
1052
+ * file that appears in {@link changedModules} after TypeScript re-emits.
1053
+ * @see transpileCache in compiler-ctx.ts
1054
+ */
1055
+ transpileCache: Map<string, {
1056
+ outputText: string;
1057
+ sourceMapText: string | null;
1058
+ }>;
1059
+ /**
1060
+ * Cross-build cache of the last style text pushed to the HMR client.
1061
+ * Keyed by getScopeId result (e.g. "ion-accordion$ios"). Used by
1062
+ * extTransformsPlugin to avoid re-pushing unchanged styles on every rebuild.
1063
+ */
1064
+ prevStylesMap: Map<string, string>;
1065
+ /**
1066
+ * Cross-output-target cache for the SASS + Lightning CSS computation.
1067
+ * Keyed by the annotated Rolldown import id. Null entries indicate that the
1068
+ * source file could not be read (propagated as a `null` return from the
1069
+ * transform hook).
1070
+ *
1071
+ * Entries are invalidated in `invalidateRolldownCaches` whenever a
1072
+ * source file or one of its SASS dependencies is modified.
1073
+ */
1074
+ cssTransformCache: Map<string, CssTransformCacheEntry | null>;
911
1075
  reset(): void;
912
1076
  }
913
1077
  type NodeMap = WeakMap<any, ComponentCompilerMeta>;
@@ -938,14 +1102,14 @@ interface ComponentCompilerFeatures {
938
1102
  hasListenerTargetWindow: boolean;
939
1103
  hasListenerTargetDocument: boolean;
940
1104
  hasListenerTargetBody: boolean;
941
- /**
942
- * @deprecated Prevented from new apps, but left in for older collections
943
- */
944
- hasListenerTargetParent: boolean;
945
1105
  hasMember: boolean;
946
1106
  hasMethod: boolean;
947
1107
  hasMode: boolean;
948
1108
  hasModernPropertyDecls: boolean;
1109
+ hasPatchAll: boolean;
1110
+ hasPatchChildren: boolean;
1111
+ hasPatchClone: boolean;
1112
+ hasPatchInsert: boolean;
949
1113
  hasProp: boolean;
950
1114
  hasPropBoolean: boolean;
951
1115
  hasPropNumber: boolean;
@@ -963,15 +1127,18 @@ interface ComponentCompilerFeatures {
963
1127
  hasVdomKey: boolean;
964
1128
  hasVdomListener: boolean;
965
1129
  hasVdomPropOrAttr: boolean;
1130
+ hasVdomPropOrAttrPrefix: boolean;
966
1131
  hasVdomRef: boolean;
967
1132
  hasVdomRender: boolean;
968
1133
  hasVdomStyle: boolean;
969
1134
  hasVdomText: boolean;
970
1135
  hasVdomXlink: boolean;
1136
+ hasSignalsImport: boolean;
971
1137
  hasWatchCallback: boolean;
972
1138
  htmlAttrNames: string[];
973
1139
  htmlTagNames: string[];
974
1140
  htmlParts: string[];
1141
+ htmlSlots: string[];
975
1142
  isUpdateable: boolean;
976
1143
  /**
977
1144
  * A plain component is one that doesn't have:
@@ -1003,7 +1170,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1003
1170
  * Custom states to initialize on the ElementInternals.states CustomStateSet.
1004
1171
  * These are defined via @AttachInternals({ states: {...} }).
1005
1172
  */
1006
- attachInternalsCustomStates: ComponentCompilerCustomState[];
1173
+ attachInternalsCustomStates: JsonDocsCustomState[];
1007
1174
  componentClassName: string;
1008
1175
  /**
1009
1176
  * A list of web component tag names that are either:
@@ -1044,16 +1211,43 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1044
1211
  properties: ComponentCompilerProperty[];
1045
1212
  serializers: ComponentCompilerChangeHandler[];
1046
1213
  shadowDelegatesFocus: boolean;
1214
+ /**
1215
+ * Whether the shadow root is preserved when the host element is deep-cloned via
1216
+ * `Node.cloneNode(true)`. Only applicable when encapsulation is 'shadow'.
1217
+ */
1218
+ shadowClonable: boolean;
1219
+ /**
1220
+ * Whether the shadow root is marked serializable for `Element.getHTML({ serializableShadowRoots: true })`.
1221
+ * Only applicable when encapsulation is 'shadow'.
1222
+ */
1223
+ shadowSerializable: boolean;
1224
+ /**
1225
+ * Shadow DOM mode. 'open' (default) or 'closed'.
1226
+ * Only applicable when encapsulation is 'shadow'.
1227
+ */
1228
+ shadowMode: 'open' | 'closed' | null;
1047
1229
  /**
1048
1230
  * Slot assignment mode for shadow DOM. 'manual', enables imperative slotting
1049
1231
  * using HTMLSlotElement.assign(). Only applicable when encapsulation is 'shadow'.
1050
1232
  */
1051
1233
  slotAssignment: 'manual' | null;
1234
+ /**
1235
+ * `id` of the element within the shadow root that IDREFs targeting the host resolve to.
1236
+ * Only applicable when encapsulation is 'shadow'.
1237
+ */
1238
+ shadowReferenceTarget: string | null;
1239
+ /**
1240
+ * Per-component slot patches for non-shadow DOM components.
1241
+ * These patches enable proper slot behavior without native Shadow DOM.
1242
+ * Only applicable when encapsulation is 'none' or 'scoped'.
1243
+ */
1244
+ patches: ComponentPatches | null;
1052
1245
  sourceFilePath: string;
1053
1246
  sourceMapPath: string;
1054
1247
  states: ComponentCompilerState[];
1055
- styleDocs: CompilerStyleDoc[];
1248
+ styleDocs: StyleDoc[];
1056
1249
  styles: StyleCompiler[];
1250
+ globalStyles: ComponentGlobalStyle[];
1057
1251
  tagName: string;
1058
1252
  virtualProperties: ComponentCompilerVirtualProperty[];
1059
1253
  watchers: ComponentCompilerChangeHandler[];
@@ -1065,6 +1259,20 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1065
1259
  * 3. 'none' - a basic HTML element
1066
1260
  */
1067
1261
  type Encapsulation = 'shadow' | 'scoped' | 'none';
1262
+ /**
1263
+ * Per-component slot patches for non-shadow DOM components.
1264
+ * These enable proper slot behavior when not using native Shadow DOM.
1265
+ */
1266
+ interface ComponentPatches {
1267
+ /** Apply all slot patches (equivalent to lightDomPatches) */
1268
+ all?: boolean;
1269
+ /** Patch child node accessors (children, firstChild, lastChild, etc.) */
1270
+ children?: boolean;
1271
+ /** Patch cloneNode() to handle slotted content */
1272
+ clone?: boolean;
1273
+ /** Patch appendChild(), insertBefore(), etc. for slot relocation */
1274
+ insert?: boolean;
1275
+ }
1068
1276
  /**
1069
1277
  * Intermediate Representation (IR) of a static property on a Stencil component
1070
1278
  */
@@ -1116,6 +1324,11 @@ interface ComponentCompilerPropertyComplexType {
1116
1324
  * annotation in the original source file.
1117
1325
  */
1118
1326
  references: ComponentCompilerTypeReferences;
1327
+ /**
1328
+ * @internal TypeScript AST node used for semantic type analysis during compilation.
1329
+ * Not serialized, only used internally for improved type renaming logic.
1330
+ */
1331
+ _astNode?: any;
1119
1332
  }
1120
1333
  /**
1121
1334
  * A record of `ComponentCompilerTypeReference` entities.
@@ -1209,6 +1422,11 @@ interface ComponentCompilerMethodComplexType {
1209
1422
  parameters: JsonDocMethodParameter[];
1210
1423
  references: ComponentCompilerTypeReferences;
1211
1424
  return: string;
1425
+ /**
1426
+ * @internal TypeScript AST method node used for semantic type analysis during compilation.
1427
+ * Not serialized, only used internally for improved type renaming logic.
1428
+ */
1429
+ _astNode?: any;
1212
1430
  }
1213
1431
  interface ComponentCompilerChangeHandler {
1214
1432
  propName: string;
@@ -1230,20 +1448,6 @@ interface ComponentCompilerState {
1230
1448
  * Custom states are exposed via the ElementInternals.states CustomStateSet
1231
1449
  * and can be targeted with the CSS :state() pseudo-class.
1232
1450
  */
1233
- interface ComponentCompilerCustomState {
1234
- /**
1235
- * The name of the custom state (without dashes)
1236
- */
1237
- name: string;
1238
- /**
1239
- * The initial value of the state
1240
- */
1241
- initialValue: boolean;
1242
- /**
1243
- * Optional JSDoc description for the state
1244
- */
1245
- docs: string;
1246
- }
1247
1451
  /**
1248
1452
  * Representation of JSDoc that is pulled off a node in the AST
1249
1453
  */
@@ -1255,44 +1459,7 @@ interface CompilerJsDoc {
1255
1459
  /**
1256
1460
  * Tags included in the JSDoc
1257
1461
  */
1258
- tags: CompilerJsDocTagInfo[];
1259
- }
1260
- /**
1261
- * Representation of a tag that exists in a JSDoc
1262
- */
1263
- interface CompilerJsDocTagInfo {
1264
- /**
1265
- * The name of the tag - e.g. `@deprecated`
1266
- */
1267
- name: string;
1268
- /**
1269
- * Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
1270
- */
1271
- text?: string;
1272
- }
1273
- /**
1274
- * The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
1275
- * the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
1276
- */
1277
- interface CompilerStyleDoc {
1278
- /**
1279
- * The name of the CSS property
1280
- */
1281
- name: string;
1282
- /**
1283
- * The user-defined description of the CSS property
1284
- */
1285
- docs: string;
1286
- /**
1287
- * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
1288
- * Used to inform Stencil where the start of a new property's description starts (and where the previous description
1289
- * ends).
1290
- */
1291
- annotation: 'prop';
1292
- /**
1293
- * The Stencil style-mode that is associated with this property.
1294
- */
1295
- mode: string;
1462
+ tags: JsonDocsTag[];
1296
1463
  }
1297
1464
  interface CompilerAssetDir {
1298
1465
  absolutePath?: string;
@@ -1344,6 +1511,7 @@ interface Module {
1344
1511
  htmlAttrNames: string[];
1345
1512
  htmlTagNames: string[];
1346
1513
  htmlParts: string[];
1514
+ htmlSlots: string[];
1347
1515
  isCollectionDependency: boolean;
1348
1516
  isLegacy: boolean;
1349
1517
  jsFilePath: string;
@@ -1368,11 +1536,13 @@ interface Module {
1368
1536
  hasVdomKey: boolean;
1369
1537
  hasVdomListener: boolean;
1370
1538
  hasVdomPropOrAttr: boolean;
1539
+ hasVdomPropOrAttrPrefix: boolean;
1371
1540
  hasVdomRef: boolean;
1372
1541
  hasVdomRender: boolean;
1373
1542
  hasVdomStyle: boolean;
1374
1543
  hasVdomText: boolean;
1375
1544
  hasVdomXlink: boolean;
1545
+ hasSignalsImport: boolean;
1376
1546
  }
1377
1547
  interface PrerenderUrlResults {
1378
1548
  anchorUrls: string[];
@@ -1385,7 +1555,7 @@ interface PrerenderUrlRequest {
1385
1555
  baseUrl: string;
1386
1556
  componentGraphPath: string;
1387
1557
  devServerHostUrl: string;
1388
- hydrateAppFilePath: string;
1558
+ ssrAppFilePath: string;
1389
1559
  isDebug: boolean;
1390
1560
  prerenderConfigPath: string;
1391
1561
  staticSite: boolean;
@@ -1405,6 +1575,12 @@ interface ExternalStyleCompiler {
1405
1575
  relativePath: string;
1406
1576
  originalComponentPath: string;
1407
1577
  }
1578
+ interface ComponentGlobalStyle {
1579
+ /** Absolute path to the CSS file, or null for inline styles */
1580
+ absolutePath: string | null;
1581
+ /** Raw inline CSS string, or null for file-based styles */
1582
+ styleStr: string | null;
1583
+ }
1408
1584
  /**
1409
1585
  * Input CSS to be transformed into ESM
1410
1586
  */
@@ -1450,10 +1626,17 @@ interface TransformCssToEsmOutput {
1450
1626
  varName: string;
1451
1627
  importPath: string;
1452
1628
  }[];
1629
+ /**
1630
+ * Whether `output` itself has an observable side effect (a plain, untagged CSS file's
1631
+ * generated module self-injects CSSStyleSheets; a Stencil component's tagged `styleUrl`
1632
+ * output doesn't)
1633
+ */
1634
+ moduleSideEffects?: boolean;
1453
1635
  }
1454
1636
  interface PackageJsonData {
1455
1637
  name?: string;
1456
1638
  version?: string;
1639
+ type?: 'module' | 'commonjs';
1457
1640
  main?: string;
1458
1641
  exports?: {
1459
1642
  [key: string]: string | {
@@ -1467,7 +1650,6 @@ interface PackageJsonData {
1467
1650
  browser?: string;
1468
1651
  module?: string;
1469
1652
  'jsnext:main'?: string;
1470
- 'collection:main'?: string;
1471
1653
  unpkg?: string;
1472
1654
  collection?: string;
1473
1655
  types?: string;
@@ -1501,10 +1683,10 @@ interface PackageJsonData {
1501
1683
  */
1502
1684
  interface CompilerWorkerContext {
1503
1685
  optimizeCss(inputOpts: OptimizeCssInput): Promise<OptimizeCssOutput>;
1504
- prepareModule(input: string, minifyOpts: any, transpile: boolean, inlineHelpers: boolean): Promise<{
1686
+ prepareModule(input: string, minifyOpts: any): Promise<{
1505
1687
  output: string;
1506
1688
  diagnostics: Diagnostic[];
1507
- sourceMap?: SourceMap;
1689
+ sourceMap?: SourceMap$1;
1508
1690
  }>;
1509
1691
  prerenderWorker(prerenderRequest: PrerenderUrlRequest): Promise<PrerenderUrlResults>;
1510
1692
  transformCssToEsm(input: TransformCssToEsmInput): Promise<TransformCssToEsmOutput>;
@@ -1595,19 +1777,14 @@ interface StencilConfig {
1595
1777
  */
1596
1778
  generateExportMaps?: boolean;
1597
1779
  /**
1598
- * When the hashFileNames config is set to true, and it is a production build,
1599
- * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
1600
- */
1601
- hashedFileNameLength?: number;
1602
- /**
1603
- * During production builds, the content of each generated file is hashed to represent the content,
1604
- * and the hashed value is used as the filename. If the content isn't updated between builds,
1605
- * then it receives the same filename. When the content is updated, then the filename is different.
1780
+ * Set to `false` to disable discovery of "CSS-only components" - pure-CSS custom-element
1781
+ * definitions marked with a `@component` JSDoc tag in `.css` files under `srcDir`. No JS
1782
+ * class, never registered via `customElements.define()` - just a documented,
1783
+ * type-checked tag name and its CSS custom properties/attribute variants.
1606
1784
  *
1607
- * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
1608
- * content delivery networks (CDNs) and heavily caching files for faster apps.
1785
+ * Defaults to `true`.
1609
1786
  */
1610
- hashFileNames?: boolean;
1787
+ enableCssOnlyComponents?: boolean;
1611
1788
  /**
1612
1789
  * The namespace config is a string representing a namespace for the app.
1613
1790
  * For apps that are not meant to be a library of reusable components,
@@ -1624,11 +1801,12 @@ interface StencilConfig {
1624
1801
  */
1625
1802
  outputTargets?: OutputTarget[];
1626
1803
  /**
1627
- * The plugins config can be used to add your own rollup plugins.
1628
- * By default, Stencil does not come with Sass or PostCSS support.
1804
+ * The plugins config can be used to add your own rolldown plugins, or Stencil's own
1805
+ * legacy `resolveId`/`load`/`transform` style plugins (identified by a `pluginType`
1806
+ * property). By default, Stencil does not come with Sass or PostCSS support.
1629
1807
  * However, either can be added using the plugin array.
1630
1808
  */
1631
- plugins?: any[];
1809
+ plugins?: (Plugin | Plugin$1)[];
1632
1810
  /**
1633
1811
  * Generate js source map files for all bundles.
1634
1812
  * Set to `true` to always generate source maps, `false` to never generate source maps.
@@ -1649,65 +1827,51 @@ interface StencilConfig {
1649
1827
  */
1650
1828
  transformAliasedImportPaths?: boolean;
1651
1829
  /**
1652
- * When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
1653
- * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1654
- */
1655
- suppressReservedPublicNameWarnings?: boolean;
1656
- /**
1657
- * When `true`, we will validate a project's `package.json` based on the output target the user has designated
1658
- * as `isPrimaryPackageOutputTarget: true` in their Stencil config.
1659
- */
1660
- validatePrimaryPackageOutputTarget?: boolean;
1661
- /**
1662
- * Passes custom configuration down to the "@rollup/plugin-commonjs" that Stencil uses under the hood.
1663
- * For further information: https://stenciljs.com/docs/module-bundling
1664
- */
1665
- commonjs?: BundlingConfig;
1666
- /**
1667
- * Passes custom configuration down to the "@rollup/plugin-node-resolve" that Stencil uses under the hood.
1830
+ * Passes custom configuration to Rolldown's module resolution (its `resolve` option), e.g. `alias`.
1668
1831
  * For further information: https://stenciljs.com/docs/module-bundling
1669
1832
  */
1670
1833
  nodeResolve?: NodeResolveConfig;
1671
1834
  /**
1672
- * Passes custom configuration down to rollup itself, not all rollup options can be overridden.
1835
+ * Passes custom configuration down to rolldown itself, not all rolldown options can be overridden.
1673
1836
  */
1674
- rollupConfig?: RollupConfig;
1837
+ rolldownConfig?: RolldownConfig;
1675
1838
  /**
1676
- * Sets if the ES5 build should be generated or not. Stencil generates a modern build without ES5,
1677
- * whereas this setting to `true` will also create es5 builds for both dev and prod modes. Setting
1678
- * `buildEs5` to `prod` will only build ES5 in prod mode. Basically if the app does not need to run
1679
- * on legacy browsers (IE11 and Edge 18 and below), it's safe to not build ES5, which will also speed
1680
- * up build times. Defaults to `false`.
1681
- */
1682
- buildEs5?: boolean | 'prod';
1683
- /**
1684
- * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
1839
+ * Sets if the JS browser files are minified or not.
1685
1840
  * Defaults to `false` in dev mode and `true` in production mode.
1686
1841
  */
1687
1842
  minifyJs?: boolean;
1843
+ /**
1844
+ * Which minifier to use for JS output when `minifyJs` is enabled.
1845
+ *
1846
+ * - `oxc`: built into rolldown. Much faster than terser. Output may be slightly larger.
1847
+ * - `terser`: slower, but currently produces the smallest output.
1848
+ *
1849
+ * Defaults to `oxc`.
1850
+ */
1851
+ jsMinifier?: 'terser' | 'oxc';
1688
1852
  /**
1689
1853
  * Sets if the CSS is minified or not.
1690
1854
  * Defaults to `false` in dev mode and `true` in production mode.
1691
1855
  */
1692
1856
  minifyCss?: boolean;
1693
- /**
1694
- * Forces Stencil to run in `dev` mode if the value is `true` and `production` mode
1695
- * if it's `false`.
1696
- *
1697
- * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
1698
- */
1699
- devMode?: boolean;
1700
1857
  /**
1701
1858
  * Object to provide a custom logger. By default a `logger` is already provided for the
1702
1859
  * platform the compiler is running on, such as NodeJS or a browser.
1703
1860
  */
1704
1861
  logger?: Logger;
1705
1862
  /**
1706
- * Config to add extra runtime for DOM features that require more polyfills. Note
1707
- * that not all DOM APIs are fully polyfilled when using the slot polyfill. These
1708
- * are opt-in since not all users will require the additional runtime.
1863
+ * Compatibility and workaround flags for framework/bundler edge cases
1864
+ * and rarely-needed diagnostic suppressions.
1865
+ */
1866
+ compat?: ConfigCompat;
1867
+ /**
1868
+ * Replace `@State` and `@Prop` internals with `@preact/signals-core` signal primitives.
1869
+ * Enables cross-framework reactive interop - component state becomes subscribable by
1870
+ * Solid, Angular, Preact and any TC39-signal-compatible library without event/attribute
1871
+ * roundtrips. No API changes required in component code.
1872
+ * Defaults to `false`.
1709
1873
  */
1710
- extras?: ConfigExtras;
1874
+ signalBacking?: boolean;
1711
1875
  /**
1712
1876
  * The hydrated flag identifies if a component and all of its child components
1713
1877
  * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
@@ -1765,22 +1929,13 @@ interface StencilConfig {
1765
1929
  docs?: StencilDocsConfig;
1766
1930
  globalScript?: string;
1767
1931
  srcIndexHtml?: string;
1768
- testing?: TestingConfig;
1769
1932
  maxConcurrentWorkers?: number;
1770
1933
  preamble?: string;
1771
- rollupPlugins?: {
1772
- before?: any[];
1773
- after?: any[];
1934
+ rolldownPlugins?: {
1935
+ before?: Plugin$1[];
1936
+ after?: Plugin$1[];
1774
1937
  };
1775
1938
  entryComponentsHint?: string[];
1776
- /**
1777
- * Sets whether Stencil will write files to `dist/` during the build or not.
1778
- *
1779
- * By default this value is set to the opposite value of {@link devMode},
1780
- * i.e. it will be `true` when building for production and `false` when
1781
- * building for development.
1782
- */
1783
- buildDist?: boolean;
1784
1939
  buildLogFilePath?: string;
1785
1940
  devInspector?: boolean;
1786
1941
  devServer?: StencilDevServerConfig;
@@ -1808,7 +1963,7 @@ interface StencilConfig {
1808
1963
  * An array of component tag names to exclude from production builds.
1809
1964
  * Useful to remove test, demo or experimental components from final output.
1810
1965
  *
1811
- * **Note:** Exclusion only applies to production builds (default, or when `--prod` is used).
1966
+ * **Note:** Exclusion only applies to production builds (the default).
1812
1967
  * Development builds (with `--dev` flag) will include all components to support local testing.
1813
1968
  *
1814
1969
  * Supports glob patterns for matching multiple components:
@@ -1832,23 +1987,78 @@ interface StencilConfig {
1832
1987
  * Set whether unused dependencies should be excluded from the built output.
1833
1988
  */
1834
1989
  excludeUnusedDependencies?: boolean;
1835
- stencilCoreResolvedId?: string;
1836
- }
1837
- interface ConfigExtrasBase {
1838
1990
  /**
1839
- * Experimental flag. Projects that use a Stencil library built using the `dist` output target may have trouble lazily
1840
- * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
1841
- * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
1842
- * the size of the compiled output. Defaults to `false`.
1843
- * @deprecated This flag has been deprecated in favor of `enableImportInjection`, which provides the same
1844
- * functionality. `experimentalImportInjection` will be removed in a future major version of Stencil.
1991
+ * Declares the set of valid style "modes" (e.g. `ios`, `md`) used by mode-keyed
1992
+ * `styleUrls`/`styles` in `@Component()`. When set, the compiler validates that
1993
+ * every mode key used in a component matches one of these entries, catching typos
1994
+ * at build time. Entries marked `required` must be present on every component that
1995
+ * defines any mode-keyed styles.
1996
+ *
1997
+ * @example
1998
+ * ```ts
1999
+ * export const config: Config = {
2000
+ * modes: ['ios', { mode: 'md', required: true }],
2001
+ * };
2002
+ * ```
2003
+ *
2004
+ * @default []
2005
+ */
2006
+ modes?: (string | ModeConfig)[];
2007
+ /**
2008
+ * Explicitly declare which npm packages are Stencil collections to be re-bundled into this project.
2009
+ *
2010
+ * Without this option, collection ingestion is triggered only by a side-effect import:
2011
+ * ```ts
2012
+ * import '@ionic/core';
2013
+ * ```
2014
+ * @example
2015
+ * ```ts
2016
+ * export const config: Config = {
2017
+ * collections: ['@ionic/core', '@my-org/design-system'],
2018
+ * };
2019
+ * ```
2020
+ *
2021
+ * @default []
1845
2022
  */
1846
- experimentalImportInjection?: boolean;
2023
+ collections?: string[];
2024
+ }
2025
+ /**
2026
+ * DOM patches for light-dom / scoped components that use `<slot>`.
2027
+ *
2028
+ * These patches shield the component's slot machinery from framework DOM mutations
2029
+ * (e.g. when Angular or React insert / remove nodes they route directly to the host
2030
+ * element, bypassing the slot polyfill) and prevent hydration errors when a framework
2031
+ * encounters Stencil's internal slot reference nodes during SSR reconciliation.
2032
+ *
2033
+ * Patches are only applied at runtime when a component is both non-shadow **and**
2034
+ * declares at least one `<slot>`, so enabling them has no effect on pure shadow-DOM
2035
+ * components.
2036
+ *
2037
+ * Set to `true` (default) to enable all patches, `false` to disable all, or an object
2038
+ * for granular control.
2039
+ */
2040
+ type LightDomPatches = {
2041
+ /** Patches `childNodes`/`children` getters to return only slotted content. */
2042
+ childNodes?: boolean;
2043
+ /** Patches `cloneNode()` to correctly deep-clone slotted content. */
2044
+ cloneNode?: boolean;
2045
+ /** Patches `appendChild()`, `insertBefore()`, and `removeChild()` to route to the correct slot, and the `innerHTML` / `innerText` setters to replace only slotted content. */
2046
+ domMutations?: boolean;
2047
+ /** Patches `textContent` to act like shadow DOM (reads/writes slotted text only). */
2048
+ textContent?: boolean;
2049
+ };
2050
+ /**
2051
+ * Compatibility and workaround flags, primarily for shielding non-shadow DOM components
2052
+ * from consuming frameworks that mutate internals they don't know about, plus other
2053
+ * framework/bundler integration edge cases and rarely-needed diagnostic suppressions.
2054
+ * These are opt-in behaviors that aren't needed by every project.
2055
+ */
2056
+ interface ConfigCompat {
1847
2057
  /**
1848
2058
  * Projects that use a Stencil library built using the `dist` output target may have trouble lazily
1849
2059
  * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
1850
2060
  * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
1851
- * the size of the compiled output. Defaults to `false`.
2061
+ * the size of the compiled output. Defaults to `true`.
1852
2062
  */
1853
2063
  enableImportInjection?: boolean;
1854
2064
  /**
@@ -1863,73 +2073,27 @@ interface ConfigExtrasBase {
1863
2073
  */
1864
2074
  initializeNextTick?: boolean;
1865
2075
  /**
1866
- * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
1867
- * can be customized at runtime. Defaults to `false`.
1868
- * @deprecated This option has been deprecated in favour of `setTagTransformer` and `transformTag`. It will be removed in a future major version of Stencil.
1869
- */
1870
- tagNameTransform?: boolean;
1871
- /**
1872
- * Adds `transformTag` calls to css strings and querySelector(All) calls
2076
+ * Adds `transformTag` calls to css strings and querySelector(All) calls.
2077
+ * Use `'prod'` to enable only in production builds.
1873
2078
  */
1874
2079
  additionalTagTransformers?: boolean | 'prod';
1875
2080
  /**
1876
- * Experimental flag.
1877
- * Updates the behavior of scoped components to align more closely with the behavior of the native
1878
- * Shadow DOM when using `slot`s.
1879
- * Defaults to `false`.
1880
- */
1881
- experimentalScopedSlotChanges?: boolean;
1882
- /**
1883
- * By default Stencil turns the stylesheet provided to `globalStyle` into a constructable stylesheet
1884
- * and adds it to each component which can be useful for sharing styles efficiently across components.
1885
- * In some cases this can be undesirable:
1886
- * - If `globalStyle` is intended to configure the lightDOM only
1887
- * - If `globalStyle` is large it can bloat the size of SSR output when using declarative-shadow-dom
1888
- * Setting this to `false` will prevent Stencil from adding any `globalStyle` to each component.
1889
- *
1890
- * Defaults to `true`.
1891
- */
1892
- addGlobalStyleToComponents?: boolean;
1893
- }
1894
- type ConfigExtrasSlotFixes<ExperimentalFixesEnabled extends boolean, IndividualFlags extends boolean> = {
1895
- /**
1896
- * By default, the slot polyfill does not update `appendChild()` so that it appends
1897
- * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
1898
- * polyfill for those who need it when using `element.appendChild(node)` and expecting the
1899
- * child to be appended in the same location shadow dom would. This is not required for
1900
- * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
1901
- */
1902
- appendChildSlotFix?: IndividualFlags;
1903
- /**
1904
- * By default, the runtime does not polyfill `cloneNode()` when cloning a component
1905
- * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
1906
- * This is not required for IE11 or Edge 18, but can be enabled if the app is using
1907
- * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
1908
- * simulating shadow dom. Defaults to `false`.
2081
+ * DOM patches for light-dom / scoped components that use `<slot>`.
2082
+ * See {@link LightDomPatches} for granular control. Defaults to `true`.
1909
2083
  */
1910
- cloneNodeFix?: IndividualFlags;
2084
+ lightDomPatches?: boolean | LightDomPatches;
1911
2085
  /**
1912
- * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
1913
- * component that uses the shadow DOM. Defaults to `false`
1914
- */
1915
- scopedSlotTextContentFix?: IndividualFlags;
1916
- /**
1917
- * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
1918
- * to simulate the same behavior. However, the host element's `childNodes` and `children`
1919
- * getters are not patched to only show the child nodes and elements of the default slot.
1920
- * Defaults to `false`.
2086
+ * When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
2087
+ * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1921
2088
  */
1922
- slotChildNodesFix?: IndividualFlags;
2089
+ suppressPublicNameWarnings?: boolean;
1923
2090
  /**
1924
- * Enables all slot-related fixes such as {@link slotChildNodesFix}, and
1925
- * {@link scopedSlotTextContentFix}.
2091
+ * When `true`, Stencil will suppress diagnostics which warn about event names conflicting with native DOM event names. Defaults to `false`.
1926
2092
  */
1927
- experimentalSlotFixes?: ExperimentalFixesEnabled;
1928
- };
1929
- type ConfigExtras = ConfigExtrasBase & (ConfigExtrasSlotFixes<true, true> | ConfigExtrasSlotFixes<false, boolean>);
2093
+ suppressEventNameWarnings?: boolean;
2094
+ }
1930
2095
  interface Config extends StencilConfig {
1931
2096
  buildAppCore?: boolean;
1932
- buildDocs?: boolean;
1933
2097
  configPath?: string;
1934
2098
  writeLog?: boolean;
1935
2099
  devServer?: DevServerConfig;
@@ -1967,10 +2131,6 @@ interface Config extends StencilConfig {
1967
2131
  * Whether to generate service worker
1968
2132
  */
1969
2133
  generateServiceWorker?: boolean;
1970
- /**
1971
- * Whether e2e tests are being run
1972
- */
1973
- e2eTests?: boolean;
1974
2134
  /**
1975
2135
  * Dev server address override
1976
2136
  */
@@ -2010,7 +2170,7 @@ interface Config extends StencilConfig {
2010
2170
  * conforming to a given interface. For best results, pair with a validation
2011
2171
  * function as shown in the example.
2012
2172
  */
2013
- type Loose<T extends Object> = Record<string, any> & Partial<T>;
2173
+ type Loose<T extends object> = Record<string, any> & Partial<T>;
2014
2174
  /**
2015
2175
  * A Loose version of the Config interface. This is intended to let us load a partial config
2016
2176
  * and have type information carry though as we construct an object which is a valid `Config`.
@@ -2025,11 +2185,11 @@ type UnvalidatedConfig = Loose<Config>;
2025
2185
  * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
2026
2186
  * ```
2027
2187
  */
2028
- type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
2188
+ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P]; };
2029
2189
  /**
2030
2190
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2031
2191
  */
2032
- type StrictConfigFields = keyof Pick<Config, 'buildEs5' | 'cacheDir' | 'devMode' | 'devServer' | 'extras' | 'fsNamespace' | 'hashFileNames' | 'hashedFileNameLength' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rollupConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'testing' | 'transformAliasedImportPaths' | 'validatePrimaryPackageOutputTarget'>;
2192
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'jsMinifier' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2033
2193
  /**
2034
2194
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2035
2195
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -2037,8 +2197,24 @@ type StrictConfigFields = keyof Pick<Config, 'buildEs5' | 'cacheDir' | 'devMode'
2037
2197
  * validations have occurred at runtime.
2038
2198
  */
2039
2199
  type ValidatedConfig = RequireFields<Config, StrictConfigFields> & {
2200
+ /**
2201
+ * Whether the build is running in development mode.
2202
+ * Set by the `--dev` CLI flag. Not user-configurable in `stencil.config.ts`.
2203
+ */
2204
+ devMode: boolean;
2040
2205
  sourceMap: boolean;
2041
2206
  };
2207
+ interface ModeConfig {
2208
+ /**
2209
+ * The mode name, matched against `styleUrls`/`styles` object keys in `@Component()`.
2210
+ */
2211
+ mode: string;
2212
+ /**
2213
+ * When `true`, every component that defines mode-keyed `styleUrls` or `styles`
2214
+ * must include this mode. Defaults to `false`.
2215
+ */
2216
+ required?: boolean;
2217
+ }
2042
2218
  interface HydratedFlag {
2043
2219
  /**
2044
2220
  * Defaults to `hydrated`.
@@ -2080,8 +2256,7 @@ interface StencilDevServerConfig {
2080
2256
  * EXPERIMENTAL!
2081
2257
  * During development, node modules can be independently requested and bundled, making for
2082
2258
  * faster build times. This is only available using the Stencil Dev Server throughout
2083
- * development. Production builds and builds with the `es5` flag will override
2084
- * this setting to `false`. Default is `false`.
2259
+ * development. Production builds will override this setting to `false`. Default is `false`.
2085
2260
  */
2086
2261
  experimentalDevModules?: boolean;
2087
2262
  /**
@@ -2182,7 +2357,8 @@ interface DevServerConfig extends StencilDevServerConfig {
2182
2357
  * reloading updates.
2183
2358
  */
2184
2359
  excludeHmr?: string[];
2185
- historyApiFallback?: HistoryApiFallback;
2360
+ /** Serve `index` for page requests that match no file (single-page app routes). `null` turns it off. */
2361
+ historyApiFallback?: HistoryApiFallback | null;
2186
2362
  openBrowser?: boolean;
2187
2363
  prerenderConfig?: string;
2188
2364
  protocol?: 'http' | 'https';
@@ -2242,11 +2418,11 @@ interface PrerenderConfig {
2242
2418
  * Run after each `document` is hydrated, but before it is serialized
2243
2419
  * into an HTML string. Hook is passed the `document` and its `URL`.
2244
2420
  */
2245
- afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2421
+ afterSsr?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2246
2422
  /**
2247
2423
  * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
2248
2424
  */
2249
- beforeHydrate?(document: Document, url: URL): any | Promise<any>;
2425
+ beforeSsr?(document: Document, url: URL): any | Promise<any>;
2250
2426
  /**
2251
2427
  * Runs after the template Document object has serialize into an
2252
2428
  * HTML formatted string. Returns an HTML string to be used as the
@@ -2290,9 +2466,9 @@ interface PrerenderConfig {
2290
2466
  */
2291
2467
  filePath?(url: URL, filePath: string): string;
2292
2468
  /**
2293
- * Returns the hydrate options to use for each individual prerendered page.
2469
+ * Returns the prerender options to use for each individual prerendered page.
2294
2470
  */
2295
- hydrateOptions?(url: URL): PrerenderHydrateOptions;
2471
+ prerenderOptions?(url: URL): PrerenderOptions;
2296
2472
  /**
2297
2473
  * Returns the template file's content. The template is the base
2298
2474
  * HTML used for all prerendered pages.
@@ -2316,7 +2492,7 @@ interface PrerenderConfig {
2316
2492
  */
2317
2493
  trailingSlash?: boolean;
2318
2494
  }
2319
- interface HydrateDocumentOptions {
2495
+ interface SsrDocumentOptions {
2320
2496
  /**
2321
2497
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
2322
2498
  * a random ID will be generated
@@ -2333,7 +2509,7 @@ interface HydrateDocumentOptions {
2333
2509
  * JavaScript to read the structure of the HTML and rebuild each
2334
2510
  * component. Defaults to `true`.
2335
2511
  */
2336
- clientHydrateAnnotations?: boolean;
2512
+ clientSsrAnnotations?: boolean;
2337
2513
  /**
2338
2514
  * Constrain `setTimeout()` to 1ms, but still async. Also
2339
2515
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -2366,6 +2542,16 @@ interface HydrateDocumentOptions {
2366
2542
  * Sets `document.referrer`
2367
2543
  */
2368
2544
  referrer?: string;
2545
+ /**
2546
+ * Render into one long-lived mock window, reset between renders, instead of creating a new one
2547
+ * for every call. Skips evaluating the whole SSR platform (runtime and every component)
2548
+ * on each render: most of the cost of rendering a small fragment, and a good part of a whole page.
2549
+ *
2550
+ * Applies to HTML string input (not a `Document`). One window per distinct `serializeShadowRoot` value,
2551
+ * and renders sharing a window run one at a time.
2552
+ * Defaults to `false`, except in the `ssr-wasm` output target, where it defaults to `true`.
2553
+ */
2554
+ reuseWindow?: boolean;
2369
2555
  /**
2370
2556
  * Removes every `<script>` element found in the `document`. Defaults to `false`.
2371
2557
  */
@@ -2432,22 +2618,35 @@ interface HydrateDocumentOptions {
2432
2618
  default: 'declarative-shadow-dom' | 'scoped';
2433
2619
  } | boolean;
2434
2620
  }
2435
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
2621
+ /**
2622
+ * Backwards compat for v4
2623
+ * @deprecated - use SsrDocumentOptions instead
2624
+ */
2625
+ interface HydrateDocumentOptions extends SsrDocumentOptions {}
2626
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
2436
2627
  /**
2437
2628
  * Runs after the `document` has been hydrated.
2438
2629
  */
2630
+ afterSsr?(document: any): any | Promise<any>;
2631
+ /**
2632
+ * @deprecated Use `afterSsr` instead.
2633
+ */
2439
2634
  afterHydrate?(document: any): any | Promise<any>;
2440
2635
  /**
2441
2636
  * Sets an approximate line width the HTML should attempt to stay within.
2442
2637
  * Note that this is "approximate", in that HTML may often not be able
2443
2638
  * to be split at an exact line width. Additionally, new lines created
2444
2639
  * is where HTML naturally already has whitespace, such as before an
2445
- * attribute or spaces between words. Defaults to `100`.
2640
+ * attribute or spaces between words. Defaults to no wrapping (`100` when prerendering).
2446
2641
  */
2447
2642
  approximateLineWidth?: number;
2448
2643
  /**
2449
2644
  * Runs before the `document` has been hydrated.
2450
2645
  */
2646
+ beforeSsr?(document: any): any | Promise<any>;
2647
+ /**
2648
+ * @deprecated Use `beforeSsr` instead.
2649
+ */
2451
2650
  beforeHydrate?(document: any): any | Promise<any>;
2452
2651
  /**
2453
2652
  * Format the HTML in a nicely indented format.
@@ -2456,12 +2655,12 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2456
2655
  prettyHtml?: boolean;
2457
2656
  /**
2458
2657
  * Remove quotes from attribute values when possible.
2459
- * Defaults to `true`.
2658
+ * Defaults to `false` (`true` when prerendering).
2460
2659
  */
2461
2660
  removeAttributeQuotes?: boolean;
2462
2661
  /**
2463
2662
  * Remove the `=""` from standardized `boolean` attributes,
2464
- * such as `hidden` or `checked`. Defaults to `true`.
2663
+ * such as `hidden` or `checked`. Defaults to `false` (`true` when prerendering).
2465
2664
  */
2466
2665
  removeBooleanAttributeQuotes?: boolean;
2467
2666
  /**
@@ -2470,7 +2669,7 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2470
2669
  */
2471
2670
  removeEmptyAttributes?: boolean;
2472
2671
  /**
2473
- * Remove HTML comments. Defaults to `true`.
2672
+ * Remove HTML comments. Defaults to `false` (`true` when prerendering).
2474
2673
  */
2475
2674
  removeHtmlComments?: boolean;
2476
2675
  /**
@@ -2485,12 +2684,23 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2485
2684
  */
2486
2685
  modes?: ResolutionHandler[];
2487
2686
  }
2488
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
2687
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
2489
2688
  serializeToHtml: boolean;
2490
2689
  destroyWindow: boolean;
2491
2690
  destroyDocument: boolean;
2691
+ /**
2692
+ * A canonical key for `serializeShadowRoot`, set by the renderer. Renders with the same key
2693
+ * render every component the same way, so they can share an SSR platform.
2694
+ * @internal
2695
+ */
2696
+ serializeShadowRootKey?: string;
2492
2697
  }
2493
- interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2698
+ /**
2699
+ * Backwards compat for v4
2700
+ * @deprecated - use SsrFactoryOptions instead
2701
+ */
2702
+ interface HydrateFactoryOptions extends SsrFactoryOptions {}
2703
+ interface PrerenderOptions extends SerializeDocumentOptions {
2494
2704
  /**
2495
2705
  * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
2496
2706
  * Defaults to `true`.
@@ -2525,6 +2735,11 @@ interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2525
2735
  */
2526
2736
  staticDocument?: boolean;
2527
2737
  }
2738
+ /**
2739
+ * v4 backwards compat
2740
+ * @deprecated - use PrerenderOptions instead
2741
+ */
2742
+ interface PrerenderHydrateOptions extends PrerenderOptions {}
2528
2743
  interface RobotsTxtOpts {
2529
2744
  urls: string[];
2530
2745
  sitemapUrl: string;
@@ -2559,7 +2774,7 @@ interface CompilerSystem {
2559
2774
  name: 'node' | 'in-memory';
2560
2775
  version: string;
2561
2776
  events?: BuildEvents;
2562
- details?: SystemDetails;
2777
+ details: SystemDetails;
2563
2778
  /**
2564
2779
  * Add a callback which will be ran when destroy() is called.
2565
2780
  */
@@ -2572,14 +2787,15 @@ interface CompilerSystem {
2572
2787
  * SYNC! Always returns a boolean, does not throw.
2573
2788
  */
2574
2789
  accessSync(p: string): boolean;
2575
- applyGlobalPatch?(fromDir: string): Promise<void>;
2576
2790
  applyPrerenderGlobalPatch?(opts: {
2577
2791
  devServerHostUrl: string;
2578
2792
  window: any;
2579
2793
  }): void;
2580
- cacheStorage?: CacheStorage;
2581
- checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
2582
- copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
2794
+ /**
2795
+ * Check npm for a newer Stencil version. Resolves a function that logs the result.
2796
+ */
2797
+ checkVersion(logger: Logger, currentVersion: string): Promise<() => void>;
2798
+ copy(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
2583
2799
  /**
2584
2800
  * Always returns a boolean if the files were copied or not. Does not throw.
2585
2801
  */
@@ -2604,7 +2820,7 @@ interface CompilerSystem {
2604
2820
  /**
2605
2821
  * Each platform has a different way to dynamically import modules.
2606
2822
  */
2607
- dynamicImport?(p: string): Promise<any>;
2823
+ dynamicImport(p: string): Promise<any>;
2608
2824
  /**
2609
2825
  * Creates the worker controller for the current system.
2610
2826
  *
@@ -2614,43 +2830,18 @@ interface CompilerSystem {
2614
2830
  */
2615
2831
  createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
2616
2832
  encodeToBase64(str: string): string;
2617
- /**
2618
- * @deprecated
2619
- */
2620
- ensureDependencies?(opts: {
2621
- rootDir: string;
2622
- logger: Logger;
2623
- dependencies: CompilerDependency[];
2624
- }): Promise<{
2625
- stencilPath: string;
2626
- diagnostics: Diagnostic[];
2627
- }>;
2628
- /**
2629
- * @deprecated
2630
- */
2631
- ensureResources?(opts: {
2632
- rootDir: string;
2633
- logger: Logger;
2634
- dependencies: CompilerDependency[];
2635
- }): Promise<void>;
2636
2833
  /**
2637
2834
  * process.exit()
2638
2835
  */
2639
2836
  exit(exitCode: number): Promise<void>;
2640
- /**
2641
- * Optionally provide a fetch() function rather than using the built-in fetch().
2642
- * First arg is a url string or Request object (RequestInfo).
2643
- * Second arg is the RequestInit. Returns the Response object
2644
- */
2645
- fetch?(input: string | any, init?: any): Promise<any>;
2646
2837
  /**
2647
2838
  * Generates a sha1 digest encoded as HEX
2648
2839
  */
2649
- generateContentHash?(content: string | any, length?: number): Promise<string>;
2840
+ generateContentHash(content: string | any, length?: number): Promise<string>;
2650
2841
  /**
2651
2842
  * Generates a sha1 digest encoded as HEX from a file path
2652
2843
  */
2653
- generateFileHash?(filePath: string | any, length?: number): Promise<string>;
2844
+ generateFileHash(filePath: string | any, length?: number): Promise<string>;
2654
2845
  /**
2655
2846
  * Get the current directory.
2656
2847
  */
@@ -2659,7 +2850,6 @@ interface CompilerSystem {
2659
2850
  * The compiler's executing path.
2660
2851
  */
2661
2852
  getCompilerExecutingPath(): string;
2662
- getEnvironmentVar?(key: string): string;
2663
2853
  /**
2664
2854
  * Gets the absolute file path when for a dependency module.
2665
2855
  */
@@ -2698,11 +2888,7 @@ interface CompilerSystem {
2698
2888
  * Normalize file system path.
2699
2889
  */
2700
2890
  normalizePath(p: string): string;
2701
- onProcessInterrupt?(cb: () => void): void;
2702
- parseYarnLockFile?: (content: string) => {
2703
- type: 'success' | 'merge' | 'conflict';
2704
- object: any;
2705
- };
2891
+ onProcessInterrupt(cb: () => void): void;
2706
2892
  platformPath: PlatformPath;
2707
2893
  /**
2708
2894
  * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
@@ -2738,6 +2924,9 @@ interface CompilerSystem {
2738
2924
  * Rename old path to new path. Does not throw.
2739
2925
  */
2740
2926
  rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
2927
+ /**
2928
+ * Assigned by the compiler. Used by plugins (e.g. `@stencil/sass`) to resolve `~` imports.
2929
+ */
2741
2930
  resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
2742
2931
  resolvePath(p: string): string;
2743
2932
  /**
@@ -2852,18 +3041,18 @@ interface ResolveModuleIdResults {
2852
3041
  * A controller which provides for communication and coordination between
2853
3042
  * threaded workers.
2854
3043
  */
2855
- interface WorkerMainController {
3044
+ interface WorkerMainController<T extends Record<string, (...args: any[]) => Promise<any>> = Record<string, (...args: any[]) => Promise<any>>> {
2856
3045
  /**
2857
3046
  * Send a given set of arguments to a worker
2858
3047
  */
2859
- send(...args: any[]): Promise<any>;
3048
+ send<K extends keyof T>(methodName: K, ...args: Parameters<T[K]>): ReturnType<T[K]>;
2860
3049
  /**
2861
3050
  * Handle a particular method
2862
3051
  *
2863
3052
  * @param name of the method to be passed to a worker
2864
3053
  * @returns a Promise wrapping the results
2865
3054
  */
2866
- handler(name: string): (...args: any[]) => Promise<any>;
3055
+ handler<K extends keyof T>(name: K): T[K];
2867
3056
  /**
2868
3057
  * Destroy the worker represented by this instance, rejecting all outstanding
2869
3058
  * tasks and killing the child process.
@@ -2930,6 +3119,8 @@ interface BuildNoChangeResults {
2930
3119
  interface CompilerBuildResults {
2931
3120
  buildId: number;
2932
3121
  componentGraph?: BuildResultsComponentGraph;
3122
+ components: ComponentCompilerMeta[];
3123
+ cssOnlyComponents: ComponentCompilerMeta[];
2933
3124
  diagnostics: Diagnostic[];
2934
3125
  dirsAdded: string[];
2935
3126
  dirsDeleted: string[];
@@ -2941,10 +3132,20 @@ interface CompilerBuildResults {
2941
3132
  hasError: boolean;
2942
3133
  hasSuccessfulBuild: boolean;
2943
3134
  hmr?: HotModuleReplacement;
2944
- hydrateAppFilePath?: string;
3135
+ ssrAppFilePath?: string;
2945
3136
  isRebuild: boolean;
2946
3137
  namespace: string;
3138
+ fsNamespace: string;
2947
3139
  outputs: BuildOutput[];
3140
+ /**
3141
+ * Absolute paths to every global stylesheet, in cascade order: each `global-style` output
3142
+ * target's compiled CSS in the order those targets are declared in `config.outputTargets` - or,
3143
+ * with none configured, the generated `{fsNamespace}.css` holding Stencil's auto-placed CSS (when
3144
+ * emitted). Unlike `outputs`, which groups files by type and sorts them alphabetically, this
3145
+ * preserves author-intended order for consumers like the dev-server's auto-generated component
3146
+ * preview.
3147
+ */
3148
+ globalStyleFiles: string[];
2948
3149
  rootDir: string;
2949
3150
  srcDir: string;
2950
3151
  timestamp: string;
@@ -2960,6 +3161,7 @@ interface HotModuleReplacement {
2960
3161
  componentsUpdated?: string[];
2961
3162
  excludeHmr?: string[];
2962
3163
  externalStylesUpdated?: string[];
3164
+ globalStylesUpdated?: HmrGlobalStyleUpdate[];
2963
3165
  imagesUpdated?: string[];
2964
3166
  indexHtmlUpdated?: boolean;
2965
3167
  inlineStylesUpdated?: HmrStyleUpdate[];
@@ -2974,6 +3176,15 @@ interface HmrStyleUpdate {
2974
3176
  styleTag: string;
2975
3177
  styleText: string;
2976
3178
  }
3179
+ /**
3180
+ * A live-reload update for a `global-style` output target's CSS. Applied on
3181
+ * the client by matching `fileName` against the `<link>` that loads it and
3182
+ * inserting/updating an adjacent `<style>` override
3183
+ */
3184
+ interface HmrGlobalStyleUpdate {
3185
+ fileName: string;
3186
+ styleText: string;
3187
+ }
2977
3188
  type BuildOnEventRemove = () => boolean;
2978
3189
  interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
2979
3190
  unsubscribeAll(): void;
@@ -3104,8 +3315,8 @@ interface ConfigBundle {
3104
3315
  }
3105
3316
  /**
3106
3317
  * A file and/or directory copy operation that may be specified as part of
3107
- * certain output targets for Stencil (in particular `dist`,
3108
- * `dist-custom-elements`, and `www`).
3318
+ * certain output targets for Stencil (in particular `loader-bundle`,
3319
+ * `standalone`, and `www`).
3109
3320
  */
3110
3321
  interface CopyTask {
3111
3322
  /**
@@ -3126,8 +3337,11 @@ interface CopyTask {
3126
3337
  */
3127
3338
  dest?: string;
3128
3339
  /**
3129
- * An optional array of glob patterns to exclude from the copy operation.
3130
- * @default ['**\/__mocks__/**', '**\/__fixtures__/**', '**\/dist/**', '**\/.{idea,git,cache,output,temp}/**', '**\/.ds_store', '**\/.gitignore', '**\/desktop.ini', '**\/thumbs.db']
3340
+ * Additional glob patterns to exclude from the copy operation, merged with
3341
+ * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
3342
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`. For a directory
3343
+ * `src`, patterns match paths relative to that directory; an explicitly
3344
+ * named `src` file is never ignored.
3131
3345
  */
3132
3346
  ignore?: string[];
3133
3347
  /**
@@ -3206,339 +3420,12 @@ interface StencilDocsConfig {
3206
3420
  };
3207
3421
  };
3208
3422
  }
3209
- interface BundlingConfig {
3210
- /**
3211
- * @deprecated the `namedExports` field is no longer honored by `@rollup/plugin-commonjs` and is not used by Stencil.
3212
- * This field can be safely removed from your Stencil configuration file.
3213
- */
3214
- namedExports?: {
3215
- [key: string]: string[];
3216
- };
3217
- }
3218
- interface NodeResolveConfig {
3219
- exportConditions?: string[];
3220
- browser?: boolean;
3221
- moduleDirectories?: string[];
3222
- modulePaths?: string[];
3223
- dedupe?: string[] | ((importee: string) => boolean);
3224
- extensions?: readonly string[];
3225
- jail?: string;
3226
- mainFields?: readonly string[];
3227
- modulesOnly?: boolean;
3228
- preferBuiltins?: boolean | ((module: string) => boolean);
3229
- resolveOnly?: ReadonlyArray<string | RegExp> | null | ((module: string) => boolean);
3230
- rootDir?: string;
3231
- allowExportsFolderMapping?: boolean;
3232
- /**
3233
- * @see https://github.com/browserify/resolve#resolveid-opts-cb
3234
- * @deprecated the `customResolveOptions` field is no longer honored in future versions of
3235
- * `@rollup/plugin-node-resolve`. If you are currently using it, please open a new issue in the Stencil repo to
3236
- * describe your use case & provide input (https://github.com/stenciljs/core/issues/new/choose)
3237
- */
3238
- customResolveOptions?: {
3239
- basedir?: string;
3240
- package?: string;
3241
- extensions?: string[];
3242
- readFile?: Function;
3243
- isFile?: Function;
3244
- isDirectory?: Function;
3245
- packageFilter?: Function;
3246
- pathFilter?: Function;
3247
- paths?: Function | string[];
3248
- moduleDirectory?: string | string[];
3249
- preserveSymlinks?: boolean;
3250
- };
3251
- }
3252
- interface RollupConfig {
3253
- inputOptions?: RollupInputOptions;
3254
- outputOptions?: RollupOutputOptions;
3255
- }
3256
- interface RollupInputOptions {
3257
- context?: string;
3258
- moduleContext?: ((id: string) => string) | {
3259
- [id: string]: string;
3260
- };
3423
+ /** Options for rolldown's built-in module resolver, passed directly to rolldown's `resolve` input option. */
3424
+ type NodeResolveConfig = NonNullable<InputOptions['resolve']>;
3425
+ interface RolldownConfig {
3261
3426
  treeshake?: boolean;
3262
- maxParallelFileOps?: number;
3263
3427
  external?: (string | RegExp)[] | string | RegExp | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | undefined);
3264
3428
  }
3265
- interface RollupOutputOptions {
3266
- globals?: {
3267
- [name: string]: string;
3268
- } | ((name: string) => string);
3269
- }
3270
- interface Testing {
3271
- run(opts: TestingRunOptions): Promise<boolean>;
3272
- destroy(): Promise<void>;
3273
- }
3274
- declare type Path = string;
3275
- declare type TransformerConfig = [string, Record<string, unknown>];
3276
- /**
3277
- * Options for initiating a run of Stencil tests (spec and/or end-to-end)
3278
- */
3279
- interface TestingRunOptions {
3280
- /**
3281
- * If true, run end-to-end tests
3282
- */
3283
- e2e?: boolean;
3284
- /**
3285
- * If true, run screenshot tests
3286
- */
3287
- screenshot?: boolean;
3288
- /**
3289
- * If true, run spec tests
3290
- */
3291
- spec?: boolean;
3292
- /**
3293
- * If true, update 'golden' screenshots. Otherwise, compare against priori.
3294
- */
3295
- updateScreenshot?: boolean;
3296
- }
3297
- interface JestConfig {
3298
- /**
3299
- * This option tells Jest that all imported modules in your tests should be mocked automatically.
3300
- * All modules used in your tests will have a replacement implementation, keeping the API surface. Default: false
3301
- */
3302
- automock?: boolean;
3303
- /**
3304
- * By default, Jest runs all tests and produces all errors into the console upon completion.
3305
- * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
3306
- */
3307
- bail?: boolean | number;
3308
- /**
3309
- * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
3310
- * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
3311
- * customize where Jest stores that cache data on disk. Default: "/tmp/<path>"
3312
- */
3313
- cacheDirectory?: string;
3314
- /**
3315
- * Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks()
3316
- * between each test. This does not remove any mock implementation that may have been provided. Default: false
3317
- */
3318
- clearMocks?: boolean;
3319
- /**
3320
- * Indicates whether the coverage information should be collected while executing the test. Because this retrofits all
3321
- * executed files with coverage collection statements, it may significantly slow down your tests. Default: false
3322
- */
3323
- collectCoverage?: boolean;
3324
- /**
3325
- * An array of glob patterns indicating a set of files for which coverage information should be collected.
3326
- * If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist
3327
- * for this file and it's never required in the test suite. Default: undefined
3328
- */
3329
- collectCoverageFrom?: any[];
3330
- /**
3331
- * The directory where Jest should output its coverage files. Default: undefined
3332
- */
3333
- coverageDirectory?: string;
3334
- /**
3335
- * An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches
3336
- * any of the patterns, coverage information will be skipped. These pattern strings match against the full path.
3337
- * Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally
3338
- * ignoring all of your files in different environments that may have different root directories.
3339
- * Example: ["<rootDir>/build/", "<rootDir>/node_modules/"]. Default: ["/node_modules/"]
3340
- */
3341
- coveragePathIgnorePatterns?: any[];
3342
- /**
3343
- * A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.
3344
- * Default: `["json", "lcov", "text"]`
3345
- */
3346
- coverageReporters?: any[];
3347
- /**
3348
- * This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global,
3349
- * as a glob, and as a directory or file path. If thresholds aren't met, jest will fail. Thresholds specified as a positive
3350
- * number are taken to be the minimum percentage required. Thresholds specified as a negative number represent the maximum
3351
- * number of uncovered entities allowed. Default: undefined
3352
- */
3353
- coverageThreshold?: any;
3354
- errorOnDeprecated?: boolean;
3355
- forceCoverageMatch?: any[];
3356
- globals?: any;
3357
- globalSetup?: string;
3358
- globalTeardown?: string;
3359
- /**
3360
- * An array of directory names to be searched recursively up from the requiring module's location. Setting this option will
3361
- * override the default, if you wish to still search node_modules for packages include it along with any other
3362
- * options: ["node_modules", "bower_components"]. Default: ["node_modules"]
3363
- */
3364
- moduleDirectories?: string[];
3365
- /**
3366
- * An array of file extensions your modules use. If you require modules without specifying a file extension,
3367
- * these are the extensions Jest will look for. Default: ['ts', 'tsx', 'js', 'json']
3368
- */
3369
- moduleFileExtensions?: string[];
3370
- moduleNameMapper?: any;
3371
- modulePaths?: any[];
3372
- modulePathIgnorePatterns?: any[];
3373
- notify?: boolean;
3374
- notifyMode?: string;
3375
- preset?: string;
3376
- prettierPath?: string;
3377
- projects?: any;
3378
- reporters?: any;
3379
- resetMocks?: boolean;
3380
- resetModules?: boolean;
3381
- resolver?: Path | null;
3382
- restoreMocks?: boolean;
3383
- rootDir?: string;
3384
- roots?: any[];
3385
- runner?: string;
3386
- /**
3387
- * The paths to modules that run some code to configure or set up the testing environment before each test.
3388
- * Since every test runs in its own environment, these scripts will be executed in the testing environment
3389
- * immediately before executing the test code itself. Default: []
3390
- */
3391
- setupFiles?: string[];
3392
- setupFilesAfterEnv?: string[];
3393
- snapshotSerializers?: any[];
3394
- testEnvironment?: string;
3395
- testEnvironmentOptions?: any;
3396
- testMatch?: string[];
3397
- testPathIgnorePatterns?: string[];
3398
- testPreset?: string;
3399
- testRegex?: string[];
3400
- testResultsProcessor?: string;
3401
- testRunner?: string;
3402
- testURL?: string;
3403
- timers?: string;
3404
- transform?: {
3405
- [regex: string]: Path | TransformerConfig;
3406
- };
3407
- transformIgnorePatterns?: any[];
3408
- unmockedModulePathPatterns?: any[];
3409
- verbose?: boolean;
3410
- watchPathIgnorePatterns?: any[];
3411
- }
3412
- interface TestingConfig extends JestConfig {
3413
- /**
3414
- * The `allowableMismatchedPixels` value is used to determine an acceptable
3415
- * number of pixels that can be mismatched before the image is considered
3416
- * to have changes. Realistically, two screenshots representing the same
3417
- * content may have a small number of pixels that are not identical due to
3418
- * anti-aliasing, which is perfectly normal. If the `allowableMismatchedRatio`
3419
- * is provided it will take precedence, otherwise `allowableMismatchedPixels`
3420
- * will be used.
3421
- */
3422
- allowableMismatchedPixels?: number;
3423
- /**
3424
- * The `allowableMismatchedRatio` ranges from `0` to `1` and is used to
3425
- * determine an acceptable ratio of pixels that can be mismatched before
3426
- * the image is considered to have changes. Realistically, two screenshots
3427
- * representing the same content may have a small number of pixels that
3428
- * are not identical due to anti-aliasing, which is perfectly normal. The
3429
- * `allowableMismatchedRatio` is the number of pixels that were mismatched,
3430
- * divided by the total number of pixels in the screenshot. For example,
3431
- * a ratio value of `0.06` means 6% of the pixels can be mismatched before
3432
- * the image is considered to have changes. If the `allowableMismatchedRatio`
3433
- * is provided it will take precedence, otherwise `allowableMismatchedPixels`
3434
- * will be used.
3435
- */
3436
- allowableMismatchedRatio?: number;
3437
- /**
3438
- * Matching threshold while comparing two screenshots. Value ranges from `0` to `1`.
3439
- * Smaller values make the comparison more sensitive. The `pixelmatchThreshold`
3440
- * value helps to ignore anti-aliasing. Default: `0.1`
3441
- */
3442
- pixelmatchThreshold?: number;
3443
- /**
3444
- * Additional arguments to pass to the browser instance.
3445
- */
3446
- browserArgs?: string[];
3447
- /**
3448
- * Path to a Chromium or Chrome executable to run instead of the bundled Chromium.
3449
- * @default env.PUPPETEER_EXECUTABLE_PATH || env.CHROME_PATH || puppeteer.computeExecutablePath()
3450
- */
3451
- browserExecutablePath?: string;
3452
- /**
3453
- * Url of remote Chrome instance to use instead of local Chrome.
3454
- */
3455
- browserWSEndpoint?: string;
3456
- /**
3457
- * The browser channel to use for e2e tests (stable, beta, dev or canary).
3458
- * @default 'chrome'
3459
- */
3460
- browserChannel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary';
3461
- /**
3462
- * Whether to run browser e2e tests in headless mode using Chrome Headless Shell
3463
- * @ref https://developer.chrome.com/blog/chrome-headless-shell
3464
- * @default shell
3465
- */
3466
- browserHeadless?: boolean | 'shell';
3467
- /**
3468
- * Slows down e2e browser operations by the specified amount of milliseconds.
3469
- * Useful so that you can see what is going on.
3470
- */
3471
- browserSlowMo?: number;
3472
- /**
3473
- * By default, all E2E pages wait until the "load" event, this global setting can be used
3474
- * to change the default `waitUntil` behavior.
3475
- */
3476
- browserWaitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
3477
- /**
3478
- * Whether to auto-open a DevTools panel for each tab.
3479
- * If this option is true, the headless option will be set false
3480
- */
3481
- browserDevtools?: boolean;
3482
- /**
3483
- * Array of browser emulations to be used during _screenshot_ tests. A full screenshot
3484
- * test is ran for each emulation.
3485
- *
3486
- * To emulate a device display for your e2e tests, use the `setViewport` method on a test's E2E page.
3487
- * An example can be found in [the Stencil docs](https://stenciljs.com/docs/end-to-end-testing#emulate-a-display).
3488
- */
3489
- emulate?: EmulateConfig[];
3490
- /**
3491
- * Path to the Screenshot Connector module.
3492
- */
3493
- screenshotConnector?: string;
3494
- /**
3495
- * Timeout for the pixelmatch worker to resolve (in ms).
3496
- * @default 2500
3497
- */
3498
- screenshotTimeout?: number | null;
3499
- /**
3500
- * Amount of time in milliseconds to wait before a screenshot is taken.
3501
- */
3502
- waitBeforeScreenshot?: number;
3503
- }
3504
- interface EmulateConfig {
3505
- /**
3506
- * Predefined device descriptor name, such as "iPhone X" or "Nexus 10".
3507
- * For a complete list please see: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
3508
- */
3509
- device?: string;
3510
- /**
3511
- * User-Agent to be used. Defaults to the user-agent of the installed Puppeteer version.
3512
- */
3513
- userAgent?: string;
3514
- viewport?: EmulateViewport;
3515
- }
3516
- interface EmulateViewport {
3517
- /**
3518
- * Page width in pixels.
3519
- */
3520
- width: number;
3521
- /**
3522
- * page height in pixels.
3523
- */
3524
- height: number;
3525
- /**
3526
- * Specify device scale factor (can be thought of as dpr). Defaults to 1.
3527
- */
3528
- deviceScaleFactor?: number;
3529
- /**
3530
- * Whether the meta viewport tag is taken into account. Defaults to false.
3531
- */
3532
- isMobile?: boolean;
3533
- /**
3534
- * Specifies if viewport supports touch events. Defaults to false
3535
- */
3536
- hasTouch?: boolean;
3537
- /**
3538
- * Specifies if viewport is in landscape mode. Defaults to false.
3539
- */
3540
- isLandscape?: boolean;
3541
- }
3542
3429
  /**
3543
3430
  * This sets the log level hierarchy for our terminal logger, ranging from
3544
3431
  * most to least verbose.
@@ -3603,54 +3490,96 @@ interface LoggerTimeSpan {
3603
3490
  duration(): number;
3604
3491
  finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
3605
3492
  }
3606
- interface OutputTargetDist extends OutputTargetValidationConfig {
3607
- type: 'dist';
3493
+ /**
3494
+ * Output target for generating lazy-loaded component bundles with a loader infrastructure.
3495
+ * This creates an optimized distribution for CDN usage and applications that benefit from
3496
+ * lazy-loading components on demand.
3497
+ *
3498
+ * Formerly known as 'dist' in v4.
3499
+ *
3500
+ * @example
3501
+ * ```typescript
3502
+ * {
3503
+ * type: 'loader-bundle',
3504
+ * dir: 'dist/loader-bundle'
3505
+ * }
3506
+ * ```
3507
+ */
3508
+ interface OutputTargetLoaderBundle extends OutputTargetBaseNext {
3509
+ type: 'loader-bundle';
3510
+ /**
3511
+ * Directory where lazy-loaded bundles will be written.
3512
+ * @default '' (root of output directory)
3513
+ */
3608
3514
  buildDir?: string;
3609
- collectionDir?: string | null;
3515
+ copy?: CopyTask[];
3516
+ empty?: boolean;
3610
3517
  /**
3611
- * When `true` this flag will transform aliased import paths defined in
3612
- * a project's `tsconfig.json` to relative import paths in the compiled output's
3613
- * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
3518
+ * Whether to generate CommonJS (CJS) bundles.
3614
3519
  *
3615
- * Paths will be left in aliased format if `false`.
3520
+ * When `true`, generates CJS output in `cjs/` subdirectory.
3521
+ * When `false` (default in v5+), only ESM bundles are generated.
3616
3522
  *
3617
- * @example
3618
- * // tsconfig.json
3619
- * {
3620
- * paths: {
3621
- * "@utils/*": ['/src/utils/*']
3622
- * }
3623
- * }
3624
- *
3625
- * // Source file
3626
- * import * as dateUtils from '@utils/date-utils';
3627
- * // Output file
3628
- * import * as dateUtils from '../utils/date-utils';
3523
+ * @default false
3629
3524
  */
3630
- transformAliasedImportPathsInCollection?: boolean | null;
3631
- typesDir?: string;
3525
+ cjs?: boolean;
3632
3526
  /**
3633
- * Provide a custom path for the ESM loader directory, containing files you can import
3527
+ * Custom path for the loader directory; files you can import
3634
3528
  * in an initiation script within your application to register all your components for
3635
3529
  * lazy loading.
3636
3530
  *
3637
- * @default /dist/loader
3531
+ * @default 'loader' (relative to output directory)
3638
3532
  */
3639
- esmLoaderPath?: string;
3640
- copy?: CopyTask[];
3641
- polyfills?: boolean;
3642
- empty?: boolean;
3533
+ loaderPath?: string;
3534
+ /**
3535
+ * Hash the filenames of generated chunks based on their content.
3536
+ * Enables forever-caching of CDN-served bundles.
3537
+ *
3538
+ * @default true in production, false in dev mode
3539
+ */
3540
+ hashFileNames?: boolean;
3541
+ /**
3542
+ * Number of characters to use for the content hash in filenames.
3543
+ *
3544
+ * @default 8
3545
+ */
3546
+ hashedFileNameLength?: number;
3547
+ /**
3548
+ * When `true`, marks `@stencil/core` as an external dependency in the bundler (ESM/CJS)
3549
+ * distribution output. Consumers must provide `@stencil/core` themselves.
3550
+ *
3551
+ * Has no effect on the browser/CDN build - the runtime is always bundled there.
3552
+ *
3553
+ * @default false
3554
+ */
3555
+ externalRuntime?: boolean;
3643
3556
  }
3644
- interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3645
- type: 'dist-collection';
3557
+ /**
3558
+ * Output target for generating Stencil component source for downstream re-bundling.
3559
+ * This output contains transpiled source code, component metadata, and configuration
3560
+ * that downstream Stencil projects can re-compile and bundle.
3561
+ *
3562
+ * Formerly 'dist-collection' sub-output in v4, now a first-class output target in v5.
3563
+ *
3564
+ * In production builds, this output is auto-generated unless explicitly configured.
3565
+ *
3566
+ * @example
3567
+ * ```typescript
3568
+ * {
3569
+ * type: 'collection',
3570
+ * dir: 'dist/collection',
3571
+ * transformAliasedImportPaths: true
3572
+ * }
3573
+ * ```
3574
+ */
3575
+ interface OutputTargetCollection extends OutputTargetBaseNext {
3576
+ type: 'collection';
3646
3577
  empty?: boolean;
3647
- dir: string;
3648
- collectionDir: string;
3649
3578
  /**
3650
3579
  * When `true` this flag will transform aliased import paths defined in
3651
3580
  * a project's `tsconfig.json` to relative import paths in the compiled output.
3652
3581
  *
3653
- * Paths will be left in aliased format if `false` or `undefined`.
3582
+ * Paths will be left in aliased format if `false`. Defaults to `true`.
3654
3583
  *
3655
3584
  * @example
3656
3585
  * // tsconfig.json
@@ -3667,49 +3596,135 @@ interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3667
3596
  */
3668
3597
  transformAliasedImportPaths?: boolean | null;
3669
3598
  }
3670
- interface OutputTargetDistTypes extends OutputTargetValidationConfig {
3671
- type: 'dist-types';
3672
- dir: string;
3673
- typesDir: string;
3599
+ /**
3600
+ * Output target for generating TypeScript type definitions (.d.ts files).
3601
+ *
3602
+ * Formerly a sub-output of 'dist' and 'dist-custom-elements' in v4,
3603
+ * now a first-class output target in v5 that can be shared across multiple outputs.
3604
+ *
3605
+ * In production builds, this output is auto-generated unless explicitly configured.
3606
+ *
3607
+ * @example
3608
+ * ```typescript
3609
+ * {
3610
+ * type: 'types',
3611
+ * dir: 'dist/types'
3612
+ * }
3613
+ * ```
3614
+ */
3615
+ interface OutputTargetTypes extends OutputTargetBaseNext {
3616
+ type: 'types';
3617
+ empty?: boolean;
3674
3618
  }
3675
3619
  interface OutputTargetDistLazy extends OutputTargetBase {
3676
3620
  type: 'dist-lazy';
3677
3621
  dir?: string;
3678
3622
  esmDir?: string;
3679
- esmEs5Dir?: string;
3680
- systemDir?: string;
3681
3623
  cjsDir?: string;
3682
- polyfills?: boolean;
3683
3624
  isBrowserBuild?: boolean;
3684
3625
  esmIndexFile?: string;
3685
3626
  cjsIndexFile?: string;
3686
- systemLoaderFile?: string;
3687
- legacyLoaderFile?: string;
3627
+ loaderDir?: string;
3628
+ typesDir?: string;
3688
3629
  empty?: boolean;
3630
+ /** Inherited from parent output target (loader-bundle or www). Only meaningful for browser builds. */
3631
+ hashFileNames?: boolean;
3632
+ /** Inherited from parent output target (loader-bundle or www). */
3633
+ hashedFileNameLength?: number;
3634
+ /** Inherited from loader-bundle. When true, @stencil/core is external in this bundler output. */
3635
+ externalRuntime?: boolean;
3689
3636
  }
3690
- interface OutputTargetDistGlobalStyles extends OutputTargetBase {
3691
- type: 'dist-global-styles';
3692
- file: string;
3693
- }
3694
- interface OutputTargetDistLazyLoader extends OutputTargetBase {
3695
- type: 'dist-lazy-loader';
3696
- dir: string;
3697
- esmDir: string;
3698
- esmEs5Dir?: string;
3699
- cjsDir: string;
3700
- componentDts: string;
3701
- empty: boolean;
3702
- }
3703
- interface OutputTargetHydrate extends OutputTargetBase {
3704
- type: 'dist-hydrate-script';
3705
- dir?: string;
3637
+ /**
3638
+ * Output target for global styles.
3639
+ * Generates a CSS file from an input stylesheet.
3640
+ *
3641
+ * Can be configured in two ways:
3642
+ * 1. **Implicit** (backwards compat): Set `globalStyle` in the config and this output is auto-generated
3643
+ * 2. **Explicit**: Define this output target with an `input` property
3644
+ *
3645
+ * Multiple `global-style` outputs are supported for building separate CSS bundles.
3646
+ *
3647
+ * @example
3648
+ * ```typescript
3649
+ * // Explicit configuration with custom input/output
3650
+ * {
3651
+ * type: 'global-style',
3652
+ * input: './src/theme.css',
3653
+ * fileName: 'theme.css',
3654
+ * dir: 'dist/assets',
3655
+ * copyToLoaderBrowser: false
3656
+ * }
3657
+ * ```
3658
+ */
3659
+ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
3660
+ type: 'global-style';
3661
+ /**
3662
+ * Path to the input CSS file to compile.
3663
+ * When specified, this takes precedence over the `globalStyle` config option.
3664
+ *
3665
+ * If neither `input` nor `globalStyle` config is set, no CSS will be built.
3666
+ */
3667
+ input?: string;
3668
+ /**
3669
+ * Output filename for the compiled CSS.
3670
+ * @default '{namespace}.css' when using globalStyle config, or basename of input file
3671
+ */
3672
+ fileName?: string;
3706
3673
  /**
3707
- * Whether to generate a package.json file in the hydrate output directory.
3708
- * Defaults to `true`
3709
- * @deprecated
3710
- * In the next major release, the `package.json` file will be completely removed from the `dist-hydrate-script` output (use `exports` from your library's main `package.json`)
3674
+ * When `true`, also copies the global style CSS to the loader-bundle browser directory
3675
+ * for backwards compatibility with existing CDN consumers who have hardcoded CSS paths.
3676
+ *
3677
+ * @default true
3711
3678
  */
3712
- generatePackageJson?: boolean;
3679
+ copyToLoaderBrowser?: boolean;
3680
+ /**
3681
+ * Controls whether this global stylesheet is injected into component shadow DOMs
3682
+ * as a constructable stylesheet at runtime.
3683
+ *
3684
+ * - `'none'`: Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
3685
+ * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
3686
+ * - `'all'`: Inject in both client and SSR builds
3687
+ *
3688
+ * @default 'client' when the stylesheet comes from `globalStyle` (or an auto-detected `src/global.*`), 'none' when `input` is set
3689
+ */
3690
+ inject?: 'none' | 'client' | 'all';
3691
+ }
3692
+ /**
3693
+ * Output target for component assets.
3694
+ * Copies all component `assetsDirs` to a unified location.
3695
+ *
3696
+ * auto-generated when components have `assetsDirs` unless explicitly configured.
3697
+ * The output is placed in `dist/assets/` by default and is available to all distribution strategies.
3698
+ *
3699
+ * @example
3700
+ * ```typescript
3701
+ * {
3702
+ * type: 'assets',
3703
+ * dir: 'dist/assets'
3704
+ * }
3705
+ * ```
3706
+ */
3707
+ interface OutputTargetAssets extends OutputTargetBaseNext {
3708
+ type: 'assets';
3709
+ }
3710
+ /**
3711
+ * Output target for server-side rendering (SSR) and hydration.
3712
+ * Generates a script that can be used for SSR and static site generation (prerendering).
3713
+ *
3714
+ * Formerly known as 'dist-hydrate-script' in v4.
3715
+ *
3716
+ * @example
3717
+ * ```typescript
3718
+ * {
3719
+ * type: 'ssr',
3720
+ * dir: 'dist/ssr',
3721
+ * minify: true
3722
+ * }
3723
+ * ```
3724
+ */
3725
+ interface OutputTargetSsr extends OutputTargetBase {
3726
+ type: 'ssr';
3727
+ dir?: string;
3713
3728
  /**
3714
3729
  * Module IDs that should not be bundled into the script.
3715
3730
  * By default, all node builtin's, such as `fs` or `path`
@@ -3718,6 +3733,26 @@ interface OutputTargetHydrate extends OutputTargetBase {
3718
3733
  external?: string[];
3719
3734
  empty?: boolean;
3720
3735
  minify?: boolean;
3736
+ /**
3737
+ * Whether to generate CommonJS (CJS) bundles.
3738
+ *
3739
+ * When `true`, generates CJS output as `index.cjs` alongside ESM `index.js`.
3740
+ * When `false` (default in v5+), only ESM bundles are generated.
3741
+ *
3742
+ * @default false
3743
+ */
3744
+ cjs?: boolean;
3745
+ }
3746
+ /**
3747
+ * Compiles the SSR hydrate app to a WASM plugin (via `extism-js`/QuickJS-ng) that can run
3748
+ * outside of Node
3749
+ */
3750
+ interface OutputTargetSsrWasm extends OutputTargetBase {
3751
+ type: 'ssr-wasm';
3752
+ /** Output directory. @default 'dist/ssr-wasm' */
3753
+ dir?: string;
3754
+ empty?: boolean;
3755
+ minify?: boolean;
3721
3756
  }
3722
3757
  interface OutputTargetCustom extends OutputTargetBase {
3723
3758
  type: 'custom';
@@ -3776,6 +3811,22 @@ interface OutputTargetDocsReadme extends OutputTargetBase {
3776
3811
  overwriteExisting?: boolean | 'if-missing';
3777
3812
  footer?: string;
3778
3813
  strict?: boolean;
3814
+ /**
3815
+ * Add extra columns to the generated Properties/Events tables, e.g. to
3816
+ * surface custom JSDoc tags as a column of their own.
3817
+ */
3818
+ customColumns?: {
3819
+ props?: DocsReadmeCustomColumn<JsonDocsProp>[];
3820
+ events?: DocsReadmeCustomColumn<JsonDocsEvent>[];
3821
+ };
3822
+ }
3823
+ /**
3824
+ * A custom column to render in a `docs-readme` Properties/Events table.
3825
+ * `content` is invoked once per row.
3826
+ */
3827
+ interface DocsReadmeCustomColumn<T> {
3828
+ header: string;
3829
+ content: (member: T, cmp: JsonDocsComponent) => string;
3779
3830
  }
3780
3831
  interface OutputTargetDocsJson extends OutputTargetBase {
3781
3832
  type: 'docs-json';
@@ -3806,9 +3857,11 @@ interface OutputTargetDocsCustomElementsManifest extends OutputTargetBase {
3806
3857
  type: 'docs-custom-elements-manifest';
3807
3858
  /**
3808
3859
  * The file path where the custom-elements.json manifest will be written.
3809
- * Defaults to 'custom-elements.json' in the root directory.
3860
+ * Defaults to 'dist/custom-elements.json'.
3861
+ *
3862
+ * The `customElements` field of the project's `package.json` is set to this path.
3810
3863
  */
3811
- file: string;
3864
+ file?: string;
3812
3865
  strict?: boolean;
3813
3866
  }
3814
3867
  interface OutputTargetDocsCustom extends OutputTargetBase {
@@ -3816,18 +3869,46 @@ interface OutputTargetDocsCustom extends OutputTargetBase {
3816
3869
  generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
3817
3870
  strict?: boolean;
3818
3871
  }
3872
+ /**
3873
+ * Output target for generating an [Agent Skill](https://agentskills.io)
3874
+ * (`SKILL.md` + per-component reference files) describing a component
3875
+ * library, so AI coding agents can consume its API and usage examples
3876
+ * directly.
3877
+ */
3878
+ interface OutputTargetDocsAgentSkill extends OutputTargetBase {
3879
+ type: 'docs-agent-skill';
3880
+ /**
3881
+ * The root directory where the skill (`SKILL.md` + `components/*.md`) is written.
3882
+ *
3883
+ * defaults to `dist/skill`
3884
+ */
3885
+ dir?: string;
3886
+ /**
3887
+ * The skill's name, used in the `SKILL.md` frontmatter.
3888
+ *
3889
+ * Defaults to {@link Config.namespace}, lowercased, with anything other than letters and numbers replaced by `-`.
3890
+ */
3891
+ name?: string;
3892
+ /**
3893
+ * The skill's description, used in the `SKILL.md` frontmatter - this is the
3894
+ * text agents use to decide when to load the skill.
3895
+ *
3896
+ * Defaults to an auto-generated sentence built from the project's
3897
+ * {@link JsonDocs.usage} (if present) or its component tags.
3898
+ */
3899
+ description?: string;
3900
+ }
3819
3901
  interface OutputTargetStats extends OutputTargetBase {
3820
3902
  type: 'stats';
3821
3903
  file?: string;
3822
3904
  }
3823
- interface OutputTargetBaseNext {
3824
- type: string;
3905
+ interface OutputTargetBaseNext extends OutputTargetBase {
3825
3906
  dir?: string;
3826
3907
  }
3827
3908
  /**
3828
3909
  * The collection of valid export behaviors.
3829
3910
  * Used to generate a type for typed configs as well as output target validation
3830
- * for the `dist-custom-elements` output target.
3911
+ * for the `standalone` output target.
3831
3912
  *
3832
3913
  * Adding a value to this const array will automatically add it as a valid option on the
3833
3914
  * output target configuration for `customElementsExportBehavior`.
@@ -3836,8 +3917,7 @@ interface OutputTargetBaseNext {
3836
3917
  * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
3837
3918
  * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
3838
3919
  * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
3839
- * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
3840
- * from `dist-custom-elements-bundle` to `dist-custom-elements`.
3920
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory.
3841
3921
  * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
3842
3922
  */
3843
3923
  declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
@@ -3846,23 +3926,38 @@ declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-de
3846
3926
  * This is used on the output target config for intellisense in typed configs.
3847
3927
  */
3848
3928
  type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
3849
- interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3850
- type: 'dist-custom-elements';
3929
+ /**
3930
+ * Output target for generating standalone component modules.
3931
+ * Each component is output as an individual ES module that can be directly imported.
3932
+ *
3933
+ * This output target is ideal for npm consumption and tree-shaking, as consumers
3934
+ * can import only the components they need.
3935
+ *
3936
+ * Formerly known as 'dist-custom-elements' in v4.
3937
+ *
3938
+ * @example
3939
+ * ```typescript
3940
+ * {
3941
+ * type: 'standalone',
3942
+ * dir: 'dist/standalone',
3943
+ * externalRuntime: true,
3944
+ * autoLoader: true
3945
+ * }
3946
+ * ```
3947
+ */
3948
+ interface OutputTargetStandalone extends OutputTargetBaseNext {
3949
+ type: 'standalone';
3851
3950
  empty?: boolean;
3852
3951
  /**
3853
- * Triggers the following behaviors when enabled:
3854
- * 1. All `@stencil/core/*` module references are treated as external during bundling.
3855
- * 2. File names are not hashed.
3856
- * 3. File minification will follow the behavior defined at the root of the Stencil config.
3952
+ * When `true`, all `@stencil/core/*` module references are treated as external
3953
+ * during bundling rather than being included in the generated output.
3954
+ *
3955
+ * @default false
3857
3956
  */
3858
3957
  externalRuntime?: boolean;
3859
3958
  copy?: CopyTask[];
3860
3959
  includeGlobalScripts?: boolean;
3861
3960
  minify?: boolean;
3862
- /**
3863
- * Enables the generation of type definition files for the output target.
3864
- */
3865
- generateTypeDeclarations?: boolean;
3866
3961
  /**
3867
3962
  * Define the export/definition behavior for the output target's generated output.
3868
3963
  * This controls if/how custom elements will be defined or where components will be exported from.
@@ -3873,6 +3968,8 @@ interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3873
3968
  * Generate an auto-loader script that uses MutationObserver to lazily load
3874
3969
  * and define custom elements as they appear in the DOM.
3875
3970
  *
3971
+ * @default true
3972
+ *
3876
3973
  * When set to `true`, generates a `loader.js` file that auto-starts on import.
3877
3974
  * Can also be configured with an object for more control:
3878
3975
  * - `fileName`: Custom filename for the loader (default: 'loader.js')
@@ -3912,27 +4009,47 @@ interface OutputTargetBase {
3912
4009
  * A unique string to differentiate one output target from another
3913
4010
  */
3914
4011
  type: string;
3915
- }
3916
- /**
3917
- * Output targets that can have validation for common `package.json` field values
3918
- * (module, types, etc.). This allows them to be marked for validation in a project's Stencil config.
3919
- */
3920
- interface OutputTargetValidationConfig extends OutputTargetBaseNext {
3921
- isPrimaryPackageOutputTarget?: boolean;
3922
- }
3923
- type EligiblePrimaryPackageOutputTarget = OutputTargetDist | OutputTargetDistCustomElements | OutputTargetDistCollection | OutputTargetDistTypes;
3924
- type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
4012
+ /**
4013
+ * When `true`, this output target will be skipped during development builds (`--dev`).
4014
+ * This improves dev build times by not generating production-only artifacts.
4015
+ *
4016
+ * Defaults vary by output target type:
4017
+ * - `loader-bundle`: `true` (skips the npm distribution files; the browser bundle always builds)
4018
+ * - `standalone`: `true` if `loader-bundle` is also configured, otherwise `false`
4019
+ * - `types`, `collection`, `ssr-wasm`: `true` (skips in dev)
4020
+ * - `assets`, `global-style`: `false` (always runs)
4021
+ * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
4022
+ * - `docs-*`: `true` (skips in dev)
4023
+ * - `custom`: `true` (skips in dev)
4024
+ * - `www`, `copy`, `stats`: `false` (always runs)
4025
+ */
4026
+ skipInDev?: boolean;
4027
+ }
4028
+ type OutputTargetBuild = OutputTargetCollection | OutputTargetDistLazy;
3925
4029
  interface OutputTargetCopy extends OutputTargetBase {
3926
4030
  type: 'copy';
3927
4031
  dir: string;
3928
4032
  copy?: CopyTask[];
3929
- copyAssets?: 'collection' | 'dist';
3930
4033
  }
3931
4034
  interface OutputTargetWww extends OutputTargetBase {
3932
4035
  /**
3933
4036
  * Webapp output target.
3934
4037
  */
3935
4038
  type: 'www';
4039
+ /**
4040
+ * Choose how components are bundled for the www output.
4041
+ *
4042
+ * - `'loader'` (default): Uses the loader-bundle architecture with chunk
4043
+ * splitting and a loader infrastructure. Best for production apps with many
4044
+ * components where you want optimal loading performance.
4045
+ *
4046
+ * - `'standalone'`: Uses standalone component modules with an auto-loader that
4047
+ * uses MutationObserver to dynamically import components as they appear in
4048
+ * the DOM. Simpler architecture, easier debugging, one module per component.
4049
+ *
4050
+ * Default: `'loader'`
4051
+ */
4052
+ bundleMode?: 'loader' | 'standalone';
3936
4053
  /**
3937
4054
  * The directory to write the app's JavaScript and CSS build
3938
4055
  * files to. The default is to place this directory as a child
@@ -3975,17 +4092,11 @@ interface OutputTargetWww extends OutputTargetBase {
3975
4092
  * Default: `/`
3976
4093
  */
3977
4094
  baseUrl?: string;
3978
- /**
3979
- * By default, stencil will include all the polyfills required by legacy browsers in the ES5 build.
3980
- * If it's `false`, stencil will not emit this polyfills anymore and it's your responsibility to provide them before
3981
- * stencil initializes.
3982
- */
3983
- polyfills?: boolean;
3984
4095
  /**
3985
4096
  * Path to an external node module which has exports of the prerender config object.
3986
4097
  * ```
3987
4098
  * module.exports = {
3988
- * afterHydrate(document, url) {
4099
+ * afterSsr(document, url) {
3989
4100
  * document.title = `URL: ${url.href}`;
3990
4101
  * }
3991
4102
  * }
@@ -3993,15 +4104,35 @@ interface OutputTargetWww extends OutputTargetBase {
3993
4104
  */
3994
4105
  prerenderConfig?: string;
3995
4106
  /**
3996
- * Service worker config for production builds. During development builds
3997
- * service worker script will be injected to automatically deregister existing
3998
- * service workers. When set to `false` neither a service worker registration
3999
- * or deregistration will be added to the index.html.
4107
+ * Service worker config for production builds. In development mode, a script
4108
+ * to deregister existing service workers is always injected. Defaults to
4109
+ * `null` (disabled). Set to `true` to enable with default settings, or provide
4110
+ * a config object for custom settings.
4000
4111
  */
4001
- serviceWorker?: ServiceWorkerConfig | null | false;
4112
+ serviceWorker?: ServiceWorkerConfig | true | null;
4002
4113
  appDir?: string;
4114
+ /**
4115
+ * Hash the filenames of generated chunks based on their content.
4116
+ * Enables forever-caching of CDN-served bundles.
4117
+ *
4118
+ * @default true in production, false in dev mode
4119
+ */
4120
+ hashFileNames?: boolean;
4121
+ /**
4122
+ * Number of characters to use for the content hash in filenames.
4123
+ *
4124
+ * @default 8
4125
+ */
4126
+ hashedFileNameLength?: number;
4003
4127
  }
4004
- type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
4128
+ type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetSsrWasm | OutputTargetCollection | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetDocsAgentSkill | OutputTargetWww | OutputTargetStats;
4129
+ /**
4130
+ * A post-validation form of {@link OutputTargetWww} where `serviceWorker`
4131
+ * has been normalized - `true` is resolved to a {@link ServiceWorkerConfig}.
4132
+ */
4133
+ type ValidatedOutputTargetWww = Omit<OutputTargetWww, 'serviceWorker'> & {
4134
+ serviceWorker?: ServiceWorkerConfig | null;
4135
+ };
4005
4136
  /**
4006
4137
  * Our custom configuration interface for generated caching Service Workers
4007
4138
  * using the Workbox library (see https://developer.chrome.com/docs/workbox/).
@@ -4049,12 +4180,6 @@ interface LoadConfigInit {
4049
4180
  configPath?: string;
4050
4181
  logger?: Logger;
4051
4182
  sys?: CompilerSystem;
4052
- /**
4053
- * When set to true, if the "tsconfig.json" file is not found
4054
- * it'll automatically generate and save a default tsconfig
4055
- * within the root directory.
4056
- */
4057
- initTsConfig?: boolean;
4058
4183
  }
4059
4184
  /**
4060
4185
  * Results from an attempt to load a config. The values on this interface
@@ -4087,33 +4212,18 @@ interface Diagnostic {
4087
4212
  relFilePath?: string | undefined;
4088
4213
  type: string;
4089
4214
  }
4090
- interface CacheStorage {
4091
- get(key: string): Promise<any>;
4092
- set(key: string, value: any): Promise<void>;
4093
- }
4094
4215
  interface WorkerOptions {
4095
4216
  maxConcurrentWorkers?: number;
4096
4217
  maxConcurrentTasksPerWorker?: number;
4097
4218
  logger?: Logger;
4098
4219
  }
4099
- interface RollupInterface {
4100
- rollup: {
4101
- (config: any): Promise<any>;
4102
- };
4103
- plugins: {
4104
- nodeResolve(opts: any): any;
4105
- replace(opts: any): any;
4106
- commonjs(opts: any): any;
4107
- json(): any;
4108
- };
4109
- }
4110
4220
  interface ResolveModuleOptions {
4111
4221
  manuallyResolve?: boolean;
4112
4222
  packageJson?: boolean;
4113
4223
  }
4114
4224
  interface PrerenderStartOptions {
4115
4225
  buildId?: string;
4116
- hydrateAppFilePath?: string;
4226
+ ssrAppFilePath?: string;
4117
4227
  componentGraph?: BuildResultsComponentGraph;
4118
4228
  srcIndexHtmlPath?: string;
4119
4229
  }
@@ -4138,14 +4248,26 @@ interface OptimizeCssInput {
4138
4248
  resolveUrl?: (url: string) => Promise<string> | string;
4139
4249
  }
4140
4250
  /**
4141
- * This is not a real interface describing the options which can
4142
- * be passed to autoprefixer, for that see the docs, here:
4143
- * https://github.com/postcss/autoprefixer#options
4251
+ * Options for autoprefixing CSS via Lightning CSS.
4252
+ *
4253
+ * The `targets` field accepts a browserslist query array. When omitted,
4254
+ * Stencil uses a modern default browser list suitable for Stencil v5+.
4144
4255
  *
4145
- * Instead, this basically just serves as a label type to track
4146
- * that arguments are being passed consistently.
4256
+ * @example
4257
+ * ```ts
4258
+ * autoprefixer: {
4259
+ * targets: ['last 2 Chrome versions', 'last 2 Safari versions', 'iOS >= 14'],
4260
+ * }
4261
+ * ```
4147
4262
  */
4148
- type AutoprefixerOptions = Object;
4263
+ interface AutoprefixerOptions {
4264
+ /**
4265
+ * A browserslist query array describing which browsers to generate vendor
4266
+ * prefixes for. Defaults to a modern set of browsers appropriate for
4267
+ * Stencil v5+.
4268
+ */
4269
+ targets?: string[];
4270
+ }
4149
4271
  /**
4150
4272
  * Output from CSS optimization functions, wrapping up optimized
4151
4273
  * CSS and any diagnostics produced during optimization.
@@ -4157,7 +4279,7 @@ interface OptimizeCssOutput {
4157
4279
  interface OptimizeJsInput {
4158
4280
  input: string;
4159
4281
  filePath?: string;
4160
- target?: 'es5' | 'latest';
4282
+ target?: 'latest';
4161
4283
  pretty?: boolean;
4162
4284
  sourceMap?: boolean;
4163
4285
  }
@@ -4171,61 +4293,23 @@ interface LazyRequire {
4171
4293
  require(fromDir: string, moduleId: string): any;
4172
4294
  getModulePath(fromDir: string, moduleId: string): string;
4173
4295
  }
4174
- /**
4175
- * @deprecated This interface is no longer used by Stencil
4176
- * TODO(STENCIL-743): Remove this interface
4177
- */
4178
- interface FsWatcherItem {
4179
- close(): void;
4180
- }
4181
- /**
4182
- * @deprecated This interface is no longer used by Stencil
4183
- * TODO(STENCIL-743): Remove this interface
4184
- */
4185
- interface MakeDirectoryOptions {
4186
- /**
4187
- * Indicates whether parent folders should be created.
4188
- * @default false
4189
- */
4190
- recursive?: boolean;
4191
- /**
4192
- * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
4193
- * @default 0o777.
4194
- */
4195
- mode?: number;
4196
- }
4197
- /**
4198
- * @deprecated This interface is no longer used by Stencil
4199
- * TODO(STENCIL-743): Remove this interface
4200
- */
4201
- interface FsStats {
4202
- isFile(): boolean;
4203
- isDirectory(): boolean;
4204
- isBlockDevice(): boolean;
4205
- isCharacterDevice(): boolean;
4206
- isSymbolicLink(): boolean;
4207
- isFIFO(): boolean;
4208
- isSocket(): boolean;
4209
- dev: number;
4210
- ino: number;
4211
- mode: number;
4212
- nlink: number;
4213
- uid: number;
4214
- gid: number;
4215
- rdev: number;
4216
- size: number;
4217
- blksize: number;
4218
- blocks: number;
4219
- atime: Date;
4220
- mtime: Date;
4221
- ctime: Date;
4222
- birthtime: Date;
4223
- }
4224
4296
  interface Compiler {
4225
4297
  build(): Promise<CompilerBuildResults>;
4226
4298
  createWatcher(): Promise<CompilerWatcher>;
4227
4299
  destroy(): Promise<void>;
4228
4300
  sys: CompilerSystem;
4301
+ /**
4302
+ * @internal - Testing only. Access to the in-memory filesystem
4303
+ */
4304
+ fs?: InMemoryFileSystem;
4305
+ /**
4306
+ * @internal - Testing only. Access to the validated configuration
4307
+ */
4308
+ config?: ValidatedConfig;
4309
+ /**
4310
+ * @internal - Testing only. Access to the compiler context
4311
+ */
4312
+ compilerCtx?: CompilerCtx;
4229
4313
  }
4230
4314
  interface CompilerWatcher extends BuildOnEvents {
4231
4315
  start: () => Promise<WatcherCloseResults>;
@@ -4254,9 +4338,11 @@ interface CompilerRequestResponse {
4254
4338
  interface TranspileOptions {
4255
4339
  /**
4256
4340
  * A component can be defined as a custom element by using `customelement`, or the
4257
- * component class can be exported by using `module`. Default is `customelement`.
4341
+ * component class can be exported by using `module`. Set to `null` to leave the
4342
+ * class's own export as-is (used with `componentMetadata: 'compilerstatic'` for
4343
+ * unit-testing preprocessors). Default is `customelement`.
4258
4344
  */
4259
- componentExport?: 'customelement' | 'module' | string | undefined;
4345
+ componentExport?: 'customelement' | 'module' | string | null | undefined;
4260
4346
  /**
4261
4347
  * Sets how and if component metadata should be assigned on the compiled
4262
4348
  * component output. The `compilerstatic` value will set the metadata to
@@ -4266,7 +4352,7 @@ interface TranspileOptions {
4266
4352
  componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
4267
4353
  /**
4268
4354
  * The actual internal import path for any `@stencil/core` imports.
4269
- * Default is `@stencil/core/runtime/client`.
4355
+ * Default is `@stencil/core/runtime/client/standalone`.
4270
4356
  */
4271
4357
  coreImportPath?: string;
4272
4358
  /**
@@ -4291,8 +4377,11 @@ interface TranspileOptions {
4291
4377
  /**
4292
4378
  * How component styles should be associated to the component. The `static`
4293
4379
  * setting will assign the styles as a static getter on the component class.
4380
+ * Set to `null` to skip the assignment entirely (and leave any `styleUrl`
4381
+ * import unresolved) - useful for unit-testing preprocessors that don't
4382
+ * need real stylesheets.
4294
4383
  */
4295
- style?: 'static' | string | undefined;
4384
+ style?: 'static' | string | null | undefined;
4296
4385
  /**
4297
4386
  * How style data should be added for imports. For example, the `queryparams` value
4298
4387
  * adds the component's tagname and encapsulation info as querystring parameter
@@ -4302,8 +4391,8 @@ interface TranspileOptions {
4302
4391
  */
4303
4392
  styleImportData?: 'queryparams' | string | undefined;
4304
4393
  /**
4305
- * The JavaScript source target TypeScript should to transpile to. Values can be
4306
- * `latest`, `esnext`, `es2017`, `es2015`, or `es5`. Defaults to `latest`.
4394
+ * The JavaScript source target TypeScript should transpile to. Values can be
4395
+ * `latest`, `esnext`, `es2020`, `es2017`, or `es2015`. Defaults to `latest`.
4307
4396
  */
4308
4397
  target?: CompileTarget;
4309
4398
  /**
@@ -4352,8 +4441,58 @@ interface TranspileOptions {
4352
4441
  * Adds `transformTag` calls to css strings and querySelector(All) calls
4353
4442
  */
4354
4443
  additionalTagTransformers?: boolean;
4444
+ /**
4445
+ * Callback used to resolve parent-class source for inheritance-chain analysis.
4446
+ * Called when a component's `extends` clause references a class from another
4447
+ * module. Return the resolved absolute path and source text of that module,
4448
+ * or `null` to skip inheritance resolution for that specifier.
4449
+ *
4450
+ * @example
4451
+ * ```ts
4452
+ * transpile(myComponentCode, {
4453
+ * resolveImport: (specifier, importer) => {
4454
+ * const resolved = require.resolve(specifier, { paths: [path.dirname(importer)] });
4455
+ * return { code: fs.readFileSync(resolved, 'utf8'), path: resolved };
4456
+ * },
4457
+ * });
4458
+ * ```
4459
+ */
4460
+ resolveImport?: (specifier: string, importer: string) => {
4461
+ code: string;
4462
+ path: string;
4463
+ } | null;
4464
+ /**
4465
+ * When `true` class declarations at the end of a `@Component` inheritance chain
4466
+ * * that have no `extends` clause * will get `extends HTMLElement` injected, and a minimal
4467
+ * `constructor() { super(); }`. Any stencil static meta-getters are also stripped.
4468
+ */
4469
+ transformAsBaseClass?: boolean;
4470
+ /**
4471
+ * Overrides for Stencil's BUILD feature flags in the generated output.
4472
+ * When set, a BUILD mutation statement is prepended to the compiled code so
4473
+ * that the specified flags take effect for this component at runtime.
4474
+ */
4475
+ buildOverrides?: BuildOverrides;
4476
+ /**
4477
+ * When `true`, a `.css`/`.scss` transpile also collects CSS custom-property docs
4478
+ * onto {@link TranspileResults.styleDocs}. Off by default, since it costs an extra parse
4479
+ * of the style text.
4480
+ */
4481
+ docs?: boolean;
4355
4482
  }
4356
- type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
4483
+ /**
4484
+ * Keys of {@link BuildConditionals} that can be meaningfully overridden at
4485
+ * transpile time — config-driven flags that are not derived from component
4486
+ * scanning or runtime environment detection.
4487
+ */
4488
+ type BuildOverrideKeys = 'isDev' | 'isTesting' | 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
4489
+ /**
4490
+ * Subset of Stencil's BUILD feature flags that can be overridden at transpile
4491
+ * time. Derived from {@link BuildConditionals} via `Pick` so the field list
4492
+ * and types stay in sync with the authoritative definition.
4493
+ */
4494
+ type BuildOverrides = Pick<BuildConditionals, BuildOverrideKeys>;
4495
+ type CompileTarget = 'latest' | 'esnext' | 'es2022' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | string | undefined;
4357
4496
  interface TranspileResults {
4358
4497
  code: string;
4359
4498
  data?: any[];
@@ -4365,6 +4504,7 @@ interface TranspileResults {
4365
4504
  inputFilePath: string;
4366
4505
  map: any;
4367
4506
  outputFilePath: string;
4507
+ styleDocs?: StyleDoc[];
4368
4508
  }
4369
4509
  interface TransformOptions {
4370
4510
  coreImportPath: string;
@@ -4378,6 +4518,17 @@ interface TransformOptions {
4378
4518
  style: 'static' | null;
4379
4519
  styleImportData: 'queryparams' | null;
4380
4520
  target?: string;
4521
+ /**
4522
+ * @see {@link TranspileOptions.resolveImport}
4523
+ */
4524
+ resolveImport?: (specifier: string, importer: string) => {
4525
+ code: string;
4526
+ path: string;
4527
+ } | null;
4528
+ /** @see {@link TranspileOptions.transformAsBaseClass} */
4529
+ transformAsBaseClass?: boolean;
4530
+ /** @see {@link TranspileOptions.buildOverrides} */
4531
+ buildOverrides?: BuildOverrides;
4381
4532
  }
4382
4533
  interface CompileScriptMinifyOptions {
4383
4534
  target?: CompileTarget;
@@ -4397,5 +4548,30 @@ interface CliInitOptions {
4397
4548
  logger: Logger;
4398
4549
  sys: CompilerSystem;
4399
4550
  }
4551
+ /**
4552
+ * A Stencil `resolveId`/`load`/`transform` plugin, as accepted by {@link StencilConfig.plugins}.
4553
+ */
4554
+ interface Plugin {
4555
+ name?: string;
4556
+ pluginType?: string;
4557
+ load?: (id: string, context: PluginCtx) => Promise<string> | string;
4558
+ resolveId?: (importee: string, importer: string, context: PluginCtx) => Promise<string> | string;
4559
+ transform?: (sourceText: string, id: string, context: PluginCtx) => Promise<PluginTransformResults> | PluginTransformResults;
4560
+ }
4561
+ type PluginTransformResults = PluginTransformationDescriptor | string | null;
4562
+ interface PluginTransformationDescriptor {
4563
+ code?: string;
4564
+ map?: string;
4565
+ id?: string;
4566
+ diagnostics?: Diagnostic[];
4567
+ dependencies?: string[];
4568
+ }
4569
+ interface PluginCtx {
4570
+ config: Config;
4571
+ sys: CompilerSystem;
4572
+ fs: InMemoryFileSystem;
4573
+ cache: Cache;
4574
+ diagnostics: Diagnostic[];
4575
+ }
4400
4576
  //#endregion
4401
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, BundlingConfig, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, EligiblePrimaryPackageOutputTarget, EmulateConfig, EmulateViewport, FsStats, FsWatchResults, FsWatcherItem, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JestConfig, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, MakeDirectoryOptions, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCopy, OutputTargetCustom, OutputTargetDist, OutputTargetDistCollection, OutputTargetDistCustomElements, OutputTargetDistGlobalStyles, OutputTargetDistLazy, OutputTargetDistLazyLoader, OutputTargetDistTypes, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetHydrate, OutputTargetStats, OutputTargetWww, PageReloadStrategy, ParsedPath, Path, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RollupConfig, RollupInputOptions, RollupInterface, RollupOutputOptions, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, Testing, TestingConfig, TestingRunOptions, TransformOptions, TransformerConfig, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };
4577
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildOverrides, BuildResultsComponentGraph, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, DocsReadmeCustomColumn, FsWatchResults, HistoryApiFallback, HmrGlobalStyleUpdate, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, ModeConfig, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsAgentSkill, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, Plugin, PluginCtx, PluginTransformResults, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, ValidatedOutputTargetWww, WatcherCloseResults, WorkerMainController, WorkerOptions };