@stencil/core 5.0.0-alpha.9 → 5.0.0-beta.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 (49) hide show
  1. package/README.md +94 -0
  2. package/dist/app-data/index.d.ts +1 -1
  3. package/dist/app-data/index.js +4 -1
  4. package/dist/client-BRu0GtRn.mjs +2368 -0
  5. package/dist/compiler/browser.d.ts +1534 -0
  6. package/dist/compiler/browser.js +16436 -0
  7. package/dist/compiler/index.d.mts +167 -3
  8. package/dist/compiler/index.mjs +3 -3
  9. package/dist/compiler/utils/index.d.mts +272 -2
  10. package/dist/compiler/utils/index.mjs +4 -3
  11. package/dist/{compiler-C0qmPoKu.mjs → compiler-CJG6qvQt.mjs} +2978 -1231
  12. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  13. package/dist/declarations/stencil-public-compiler.d.ts +226 -69
  14. package/dist/declarations/stencil-public-docs.d.ts +9 -0
  15. package/dist/declarations/stencil-public-runtime.d.ts +111 -10
  16. package/dist/fragment-Di1hWOC8.mjs +4 -0
  17. package/dist/{regular-expression-CFVJOTUh.mjs → helpers-Cpp3qc3u.mjs} +31 -15
  18. package/dist/{index-xAkMgLX_.d.ts → index-BXAcVN2j.d.ts} +152 -20
  19. package/dist/{index-vY35H18z.d.mts → index-BopBfjPu.d.mts} +508 -848
  20. package/dist/index-DmHmu3y0.d.mts +100 -0
  21. package/dist/index.d.mts +6 -0
  22. package/dist/index.mjs +171 -2
  23. package/dist/jsx-runtime.mjs +2 -1
  24. package/dist/{node--akYC-sG.mjs → node-75gQKkFz.mjs} +60 -58
  25. package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  26. package/dist/runtime/client/lazy.js +577 -189
  27. package/dist/runtime/client/runtime.d.ts +178 -21
  28. package/dist/runtime/client/runtime.js +577 -189
  29. package/dist/runtime/index.d.ts +32 -4
  30. package/dist/runtime/index.js +576 -187
  31. package/dist/runtime/server/index.d.mts +107 -9
  32. package/dist/runtime/server/index.mjs +499 -182
  33. package/dist/runtime/server/runner.d.mts +3 -0
  34. package/dist/runtime/server/runner.mjs +320 -337
  35. package/dist/signals/index.d.ts +2 -0
  36. package/dist/signals/index.js +4 -1
  37. package/dist/sys/node/index.d.mts +1 -2
  38. package/dist/sys/node/index.mjs +1 -1
  39. package/dist/sys/node/worker.d.mts +1 -1
  40. package/dist/sys/node/worker.mjs +6 -3
  41. package/dist/testing/index.d.mts +4731 -105
  42. package/dist/testing/index.mjs +7563 -797
  43. package/dist/util-IKfWWLJo.mjs +724 -0
  44. package/dist/validation-DAdGTrys.mjs +791 -0
  45. package/package.json +31 -27
  46. package/dist/client-aTQ7xHxx.mjs +0 -4678
  47. package/dist/index-BvkyxSY6.d.mts +0 -205
  48. package/dist/validation-ByxKj8bC.mjs +0 -1458
  49. /package/{LICENSE.md → LICENSE} +0 -0
@@ -1,24 +1,24 @@
1
- declare module "*.css" {
1
+ declare module "*.css?stencil" {
2
2
  const src: () => string;
3
3
  export default src;
4
4
  }
5
5
 
6
- declare module "*.svg" {
6
+ declare module "*.svg?stencil" {
7
7
  const src: string;
8
8
  export default src;
9
9
  }
10
10
 
11
- declare module "*.txt" {
11
+ declare module "*.txt?stencil" {
12
12
  const src: string;
13
13
  export default src;
14
14
  }
15
15
 
16
- declare module "*.frag" {
16
+ declare module "*.frag?stencil" {
17
17
  const src: string;
18
18
  export default src;
19
19
  }
20
20
 
21
- declare module "*.vert" {
21
+ declare module "*.vert?stencil" {
22
22
  const src: string;
23
23
  export default src;
24
24
  }
@@ -1,5 +1,6 @@
1
1
  import { ListenTargetOptions, ResolutionHandler } from "./stencil-public-runtime.js";
2
- import { InputOptions, SourceMap as RolldownSourceMap } from "rolldown";
2
+ import { InputOptions, Plugin, 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
  */
@@ -655,7 +642,7 @@ interface StyleDoc {
655
642
  }
656
643
  //#endregion
657
644
  //#region src/declarations/stencil-private.d.ts
658
- interface SourceMap {
645
+ interface SourceMap$1 {
659
646
  file: string;
660
647
  mappings: string;
661
648
  names: string[];
@@ -679,6 +666,8 @@ interface BuildFeatures {
679
666
  shadowDelegatesFocus: boolean;
680
667
  shadowModeClosed: boolean;
681
668
  shadowSlotAssignmentManual: boolean;
669
+ shadowClonable: boolean;
670
+ shadowSerializable: boolean;
682
671
  scoped: boolean;
683
672
  /**
684
673
  * Every component has a render function
@@ -695,6 +684,8 @@ interface BuildFeatures {
695
684
  vdomKey: boolean;
696
685
  vdomListener: boolean;
697
686
  vdomPropOrAttr: boolean;
687
+ /** True when at least one component uses the explicit `attr:`/`prop:` JSX prefix. */
688
+ vdomPropOrAttrPrefix: boolean;
698
689
  vdomRef: boolean;
699
690
  vdomStyle: boolean;
700
691
  vdomText: boolean;
@@ -913,7 +904,7 @@ interface RolldownChunkResult {
913
904
  isBrowserLoader: boolean;
914
905
  imports: string[];
915
906
  moduleFormat: ModuleFormat;
916
- map?: RolldownSourceMap;
907
+ map?: SourceMap;
917
908
  }
918
909
  interface BundleModule {
919
910
  entryKey: string;
@@ -1092,6 +1083,7 @@ interface ComponentCompilerFeatures {
1092
1083
  hasVdomKey: boolean;
1093
1084
  hasVdomListener: boolean;
1094
1085
  hasVdomPropOrAttr: boolean;
1086
+ hasVdomPropOrAttrPrefix: boolean;
1095
1087
  hasVdomRef: boolean;
1096
1088
  hasVdomRender: boolean;
1097
1089
  hasVdomStyle: boolean;
@@ -1102,6 +1094,7 @@ interface ComponentCompilerFeatures {
1102
1094
  htmlAttrNames: string[];
1103
1095
  htmlTagNames: string[];
1104
1096
  htmlParts: string[];
1097
+ htmlSlots: string[];
1105
1098
  isUpdateable: boolean;
1106
1099
  /**
1107
1100
  * A plain component is one that doesn't have:
@@ -1174,6 +1167,16 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1174
1167
  properties: ComponentCompilerProperty[];
1175
1168
  serializers: ComponentCompilerChangeHandler[];
1176
1169
  shadowDelegatesFocus: boolean;
1170
+ /**
1171
+ * Whether the shadow root is preserved when the host element is deep-cloned via
1172
+ * `Node.cloneNode(true)`. Only applicable when encapsulation is 'shadow'.
1173
+ */
1174
+ shadowClonable: boolean;
1175
+ /**
1176
+ * Whether the shadow root is marked serializable for `Element.getHTML({ serializableShadowRoots: true })`.
1177
+ * Only applicable when encapsulation is 'shadow'.
1178
+ */
1179
+ shadowSerializable: boolean;
1177
1180
  /**
1178
1181
  * Shadow DOM mode. 'open' (default) or 'closed'.
1179
1182
  * Only applicable when encapsulation is 'shadow'.
@@ -1510,6 +1513,7 @@ interface Module {
1510
1513
  htmlAttrNames: string[];
1511
1514
  htmlTagNames: string[];
1512
1515
  htmlParts: string[];
1516
+ htmlSlots: string[];
1513
1517
  isCollectionDependency: boolean;
1514
1518
  isLegacy: boolean;
1515
1519
  jsFilePath: string;
@@ -1534,6 +1538,7 @@ interface Module {
1534
1538
  hasVdomKey: boolean;
1535
1539
  hasVdomListener: boolean;
1536
1540
  hasVdomPropOrAttr: boolean;
1541
+ hasVdomPropOrAttrPrefix: boolean;
1537
1542
  hasVdomRef: boolean;
1538
1543
  hasVdomRender: boolean;
1539
1544
  hasVdomStyle: boolean;
@@ -1541,6 +1546,28 @@ interface Module {
1541
1546
  hasVdomXlink: boolean;
1542
1547
  hasSignalsImport: boolean;
1543
1548
  }
1549
+ interface Plugin$1 {
1550
+ name?: string;
1551
+ pluginType?: string;
1552
+ load?: (id: string, context: PluginCtx) => Promise<string> | string;
1553
+ resolveId?: (importee: string, importer: string, context: PluginCtx) => Promise<string> | string;
1554
+ transform?: (sourceText: string, id: string, context: PluginCtx) => Promise<PluginTransformResults> | PluginTransformResults;
1555
+ }
1556
+ type PluginTransformResults = PluginTransformationDescriptor | string | null;
1557
+ interface PluginTransformationDescriptor {
1558
+ code?: string;
1559
+ map?: string;
1560
+ id?: string;
1561
+ diagnostics?: Diagnostic[];
1562
+ dependencies?: string[];
1563
+ }
1564
+ interface PluginCtx {
1565
+ config: Config;
1566
+ sys: CompilerSystem;
1567
+ fs: InMemoryFileSystem;
1568
+ cache: Cache;
1569
+ diagnostics: Diagnostic[];
1570
+ }
1544
1571
  interface PrerenderUrlResults {
1545
1572
  anchorUrls: string[];
1546
1573
  diagnostics: Diagnostic[];
@@ -1623,6 +1650,12 @@ interface TransformCssToEsmOutput {
1623
1650
  varName: string;
1624
1651
  importPath: string;
1625
1652
  }[];
1653
+ /**
1654
+ * Whether `output` itself has an observable side effect (a plain, untagged CSS file's
1655
+ * generated module self-injects CSSStyleSheets; a Stencil component's tagged `styleUrl`
1656
+ * output doesn't)
1657
+ */
1658
+ moduleSideEffects?: boolean;
1626
1659
  }
1627
1660
  interface PackageJsonData {
1628
1661
  name?: string;
@@ -1677,7 +1710,7 @@ interface CompilerWorkerContext {
1677
1710
  prepareModule(input: string, minifyOpts: any): Promise<{
1678
1711
  output: string;
1679
1712
  diagnostics: Diagnostic[];
1680
- sourceMap?: SourceMap;
1713
+ sourceMap?: SourceMap$1;
1681
1714
  }>;
1682
1715
  prerenderWorker(prerenderRequest: PrerenderUrlRequest): Promise<PrerenderUrlResults>;
1683
1716
  transformCssToEsm(input: TransformCssToEsmInput): Promise<TransformCssToEsmOutput>;
@@ -1783,11 +1816,12 @@ interface StencilConfig {
1783
1816
  */
1784
1817
  outputTargets?: OutputTarget[];
1785
1818
  /**
1786
- * The plugins config can be used to add your own rolldown plugins.
1787
- * By default, Stencil does not come with Sass or PostCSS support.
1819
+ * The plugins config can be used to add your own rolldown plugins, or Stencil's own
1820
+ * legacy `resolveId`/`load`/`transform` style plugins (identified by a `pluginType`
1821
+ * property). By default, Stencil does not come with Sass or PostCSS support.
1788
1822
  * However, either can be added using the plugin array.
1789
1823
  */
1790
- plugins?: any[];
1824
+ plugins?: (Plugin$1 | Plugin)[];
1791
1825
  /**
1792
1826
  * Generate js source map files for all bundles.
1793
1827
  * Set to `true` to always generate source maps, `false` to never generate source maps.
@@ -1807,15 +1841,6 @@ interface StencilConfig {
1807
1841
  * This behavior defaults to `true`, but may be opted-out of by setting this flag to `false`.
1808
1842
  */
1809
1843
  transformAliasedImportPaths?: boolean;
1810
- /**
1811
- * When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
1812
- * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1813
- */
1814
- suppressReservedPublicNameWarnings?: boolean;
1815
- /**
1816
- * When `true`, Stencil will suppress diagnostics which warn about event names conflicting with native DOM event names. Defaults to `false`.
1817
- */
1818
- suppressReservedEventNameWarnings?: boolean;
1819
1844
  /**
1820
1845
  * Passes custom configuration down to the "@rolldown/plugin-node-resolve" that Stencil uses under the hood.
1821
1846
  * For further information: https://stenciljs.com/docs/module-bundling
@@ -1826,10 +1851,19 @@ interface StencilConfig {
1826
1851
  */
1827
1852
  rolldownConfig?: RolldownConfig;
1828
1853
  /**
1829
- * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
1854
+ * Sets if the JS browser files are minified or not.
1830
1855
  * Defaults to `false` in dev mode and `true` in production mode.
1831
1856
  */
1832
1857
  minifyJs?: boolean;
1858
+ /**
1859
+ * Which minifier to use for JS output when `minifyJs` is enabled.
1860
+ *
1861
+ * - `oxc`: built into rolldown. Much faster than terser. Output may be slightly larger.
1862
+ * - `terser`: slower, but currently produces the smallest output.
1863
+ *
1864
+ * Defaults to `oxc`.
1865
+ */
1866
+ jsMinifier?: 'terser' | 'oxc';
1833
1867
  /**
1834
1868
  * Sets if the CSS is minified or not.
1835
1869
  * Defaults to `false` in dev mode and `true` in production mode.
@@ -1841,7 +1875,8 @@ interface StencilConfig {
1841
1875
  */
1842
1876
  logger?: Logger;
1843
1877
  /**
1844
- * Compatibility and workaround flags for framework integration and bundler edge cases.
1878
+ * Compatibility and workaround flags for framework/bundler edge cases
1879
+ * and rarely-needed diagnostic suppressions.
1845
1880
  */
1846
1881
  compat?: ConfigCompat;
1847
1882
  /**
@@ -1912,8 +1947,8 @@ interface StencilConfig {
1912
1947
  maxConcurrentWorkers?: number;
1913
1948
  preamble?: string;
1914
1949
  rolldownPlugins?: {
1915
- before?: any[];
1916
- after?: any[];
1950
+ before?: Plugin[];
1951
+ after?: Plugin[];
1917
1952
  };
1918
1953
  entryComponentsHint?: string[];
1919
1954
  buildLogFilePath?: string;
@@ -1967,6 +2002,23 @@ interface StencilConfig {
1967
2002
  * Set whether unused dependencies should be excluded from the built output.
1968
2003
  */
1969
2004
  excludeUnusedDependencies?: boolean;
2005
+ /**
2006
+ * Declares the set of valid style "modes" (e.g. `ios`, `md`) used by mode-keyed
2007
+ * `styleUrls`/`styles` in `@Component()`. When set, the compiler validates that
2008
+ * every mode key used in a component matches one of these entries, catching typos
2009
+ * at build time. Entries marked `required` must be present on every component that
2010
+ * defines any mode-keyed styles.
2011
+ *
2012
+ * @example
2013
+ * ```ts
2014
+ * export const config: Config = {
2015
+ * modes: ['ios', { mode: 'md', required: true }],
2016
+ * };
2017
+ * ```
2018
+ *
2019
+ * @default []
2020
+ */
2021
+ modes?: (string | ModeConfig)[];
1970
2022
  /**
1971
2023
  * Explicitly declare which npm packages are Stencil collections to be re-bundled into this project.
1972
2024
  *
@@ -1984,7 +2036,6 @@ interface StencilConfig {
1984
2036
  * @default []
1985
2037
  */
1986
2038
  collections?: string[];
1987
- stencilCoreResolvedId?: string;
1988
2039
  }
1989
2040
  /**
1990
2041
  * DOM patches for light-dom / scoped components that use `<slot>`.
@@ -2002,14 +2053,20 @@ interface StencilConfig {
2002
2053
  * for granular control.
2003
2054
  */
2004
2055
  type LightDomPatches = {
2005
- /** Patches `childNodes`/`children` getters to return only slotted content. */childNodes?: boolean; /** Patches `cloneNode()` to correctly deep-clone slotted content. */
2006
- cloneNode?: boolean; /** Patches `appendChild()`, `insertBefore()`, and `removeChild()` to route to the correct slot. */
2007
- domMutations?: boolean; /** Patches `textContent` to act like shadow DOM (reads/writes slotted text only). */
2056
+ /** Patches `childNodes`/`children` getters to return only slotted content. */
2057
+ childNodes?: boolean;
2058
+ /** Patches `cloneNode()` to correctly deep-clone slotted content. */
2059
+ cloneNode?: boolean;
2060
+ /** Patches `appendChild()`, `insertBefore()`, and `removeChild()` to route to the correct slot. */
2061
+ domMutations?: boolean;
2062
+ /** Patches `textContent` to act like shadow DOM (reads/writes slotted text only). */
2008
2063
  textContent?: boolean;
2009
2064
  };
2010
2065
  /**
2011
- * Compatibility and workaround flags for framework integration and bundler edge cases.
2012
- * These are opt-in runtime behaviors that aren't needed by every project.
2066
+ * Compatibility and workaround flags, primarily for shielding non-shadow DOM components
2067
+ * from consuming frameworks that mutate internals they don't know about, plus other
2068
+ * framework/bundler integration edge cases and rarely-needed diagnostic suppressions.
2069
+ * These are opt-in behaviors that aren't needed by every project.
2013
2070
  */
2014
2071
  interface ConfigCompat {
2015
2072
  /**
@@ -2040,6 +2097,15 @@ interface ConfigCompat {
2040
2097
  * See {@link LightDomPatches} for granular control. Defaults to `true`.
2041
2098
  */
2042
2099
  lightDomPatches?: boolean | LightDomPatches;
2100
+ /**
2101
+ * When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
2102
+ * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
2103
+ */
2104
+ suppressPublicNameWarnings?: boolean;
2105
+ /**
2106
+ * When `true`, Stencil will suppress diagnostics which warn about event names conflicting with native DOM event names. Defaults to `false`.
2107
+ */
2108
+ suppressEventNameWarnings?: boolean;
2043
2109
  }
2044
2110
  interface Config extends StencilConfig {
2045
2111
  buildAppCore?: boolean;
@@ -2139,11 +2205,11 @@ type UnvalidatedConfig = Loose<Config>;
2139
2205
  * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
2140
2206
  * ```
2141
2207
  */
2142
- type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
2208
+ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P]; };
2143
2209
  /**
2144
2210
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2145
2211
  */
2146
- type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2212
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'jsMinifier' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2147
2213
  /**
2148
2214
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2149
2215
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -2158,6 +2224,17 @@ type ValidatedConfig = RequireFields<Config, StrictConfigFields> & {
2158
2224
  devMode: boolean;
2159
2225
  sourceMap: boolean;
2160
2226
  };
2227
+ interface ModeConfig {
2228
+ /**
2229
+ * The mode name, matched against `styleUrls`/`styles` object keys in `@Component()`.
2230
+ */
2231
+ mode: string;
2232
+ /**
2233
+ * When `true`, every component that defines mode-keyed `styleUrls` or `styles`
2234
+ * must include this mode. Defaults to `false`.
2235
+ */
2236
+ required?: boolean;
2237
+ }
2161
2238
  interface HydratedFlag {
2162
2239
  /**
2163
2240
  * Defaults to `hydrated`.
@@ -3718,6 +3795,22 @@ interface OutputTargetDocsReadme extends OutputTargetBase {
3718
3795
  overwriteExisting?: boolean | 'if-missing';
3719
3796
  footer?: string;
3720
3797
  strict?: boolean;
3798
+ /**
3799
+ * Add extra columns to the generated Properties/Events tables, e.g. to
3800
+ * surface custom JSDoc tags as a column of their own.
3801
+ */
3802
+ customColumns?: {
3803
+ props?: DocsReadmeCustomColumn<JsonDocsProp>[];
3804
+ events?: DocsReadmeCustomColumn<JsonDocsEvent>[];
3805
+ };
3806
+ }
3807
+ /**
3808
+ * A custom column to render in a `docs-readme` Properties/Events table.
3809
+ * `content` is invoked once per row.
3810
+ */
3811
+ interface DocsReadmeCustomColumn<T> {
3812
+ header: string;
3813
+ content: (member: T, cmp: JsonDocsComponent) => string;
3721
3814
  }
3722
3815
  interface OutputTargetDocsJson extends OutputTargetBase {
3723
3816
  type: 'docs-json';
@@ -3758,6 +3851,35 @@ interface OutputTargetDocsCustom extends OutputTargetBase {
3758
3851
  generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
3759
3852
  strict?: boolean;
3760
3853
  }
3854
+ /**
3855
+ * Output target for generating an [Agent Skill](https://agentskills.io)
3856
+ * (`SKILL.md` + per-component reference files) describing a component
3857
+ * library, so AI coding agents can consume its API and usage examples
3858
+ * directly.
3859
+ */
3860
+ interface OutputTargetDocsAgentSkill extends OutputTargetBase {
3861
+ type: 'docs-agent-skill';
3862
+ /**
3863
+ * The root directory where the skill (`SKILL.md` + `components/*.md`) is written.
3864
+ *
3865
+ * defaults to `dist/skill`
3866
+ */
3867
+ dir?: string;
3868
+ /**
3869
+ * The skill's name, used in the `SKILL.md` frontmatter.
3870
+ *
3871
+ * Defaults to a kebab-cased form of {@link Config.namespace}.
3872
+ */
3873
+ name?: string;
3874
+ /**
3875
+ * The skill's description, used in the `SKILL.md` frontmatter - this is the
3876
+ * text agents use to decide when to load the skill.
3877
+ *
3878
+ * Defaults to an auto-generated sentence built from the project's
3879
+ * {@link JsonDocs.usage} (if present) or its component tags.
3880
+ */
3881
+ description?: string;
3882
+ }
3761
3883
  interface OutputTargetStats extends OutputTargetBase {
3762
3884
  type: 'stats';
3763
3885
  file?: string;
@@ -3985,7 +4107,7 @@ interface OutputTargetWww extends OutputTargetBase {
3985
4107
  */
3986
4108
  hashedFileNameLength?: number;
3987
4109
  }
3988
- type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetSsrWasm | OutputTargetCollection | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetStats;
4110
+ type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetSsrWasm | OutputTargetCollection | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetDocsAgentSkill | OutputTargetWww | OutputTargetStats;
3989
4111
  /**
3990
4112
  * A post-validation form of {@link OutputTargetWww} where `serviceWorker`
3991
4113
  * has been normalized - `true` is resolved to a {@link ServiceWorkerConfig}.
@@ -4202,9 +4324,11 @@ interface CompilerRequestResponse {
4202
4324
  interface TranspileOptions {
4203
4325
  /**
4204
4326
  * A component can be defined as a custom element by using `customelement`, or the
4205
- * component class can be exported by using `module`. Default is `customelement`.
4327
+ * component class can be exported by using `module`. Set to `null` to leave the
4328
+ * class's own export as-is (used with `componentMetadata: 'compilerstatic'` for
4329
+ * unit-testing preprocessors). Default is `customelement`.
4206
4330
  */
4207
- componentExport?: 'customelement' | 'module' | string | undefined;
4331
+ componentExport?: 'customelement' | 'module' | string | null | undefined;
4208
4332
  /**
4209
4333
  * Sets how and if component metadata should be assigned on the compiled
4210
4334
  * component output. The `compilerstatic` value will set the metadata to
@@ -4239,8 +4363,11 @@ interface TranspileOptions {
4239
4363
  /**
4240
4364
  * How component styles should be associated to the component. The `static`
4241
4365
  * setting will assign the styles as a static getter on the component class.
4366
+ * Set to `null` to skip the assignment entirely (and leave any `styleUrl`
4367
+ * import unresolved) - useful for unit-testing preprocessors that don't
4368
+ * need real stylesheets.
4242
4369
  */
4243
- style?: 'static' | string | undefined;
4370
+ style?: 'static' | string | null | undefined;
4244
4371
  /**
4245
4372
  * How style data should be added for imports. For example, the `queryparams` value
4246
4373
  * adds the component's tagname and encapsulation info as querystring parameter
@@ -4301,28 +4428,51 @@ interface TranspileOptions {
4301
4428
  */
4302
4429
  additionalTagTransformers?: boolean;
4303
4430
  /**
4304
- * A map of virtual file paths to source text for modules that the component
4305
- * under transpilation extends from. When provided, `transpile()` builds a
4306
- * minimal multi-file TypeScript program from these sources so that
4307
- * {@link https://stenciljs.com/docs/component-lifecycle inheritance chains}
4308
- * can be resolved without requiring the parent files to exist on disk.
4309
- *
4310
- * Keys are the same import paths used in the component's `import` statements
4311
- * (relative paths are resolved against `currentDirectory`). Values are the
4312
- * TypeScript/JavaScript source text of that module.
4431
+ * Callback used to resolve parent-class source for inheritance-chain analysis.
4432
+ * Called when a component's `extends` clause references a class from another
4433
+ * module. Return the resolved absolute path and source text of that module,
4434
+ * or `null` to skip inheritance resolution for that specifier.
4313
4435
  *
4314
4436
  * @example
4315
4437
  * ```ts
4316
4438
  * transpile(myComponentCode, {
4317
- * extraFiles: {
4318
- * './base-component.ts': baseComponentSourceText,
4439
+ * resolveImport: (specifier, importer) => {
4440
+ * const resolved = require.resolve(specifier, { paths: [path.dirname(importer)] });
4441
+ * return { code: fs.readFileSync(resolved, 'utf8'), path: resolved };
4319
4442
  * },
4320
4443
  * });
4321
4444
  * ```
4322
4445
  */
4323
- extraFiles?: Record<string, string>;
4446
+ resolveImport?: (specifier: string, importer: string) => {
4447
+ code: string;
4448
+ path: string;
4449
+ } | null;
4450
+ /**
4451
+ * When `true` class declarations at the end of a `@Component` inheritance chain
4452
+ * * that have no `extends` clause * will get `extends HTMLElement` injected, and a minimal
4453
+ * `constructor() { super(); }`. Any stencil static meta-getters are also stripped.
4454
+ */
4455
+ transformAsBaseClass?: boolean;
4456
+ /**
4457
+ * Overrides for Stencil's BUILD feature flags in the generated output.
4458
+ * When set, a BUILD mutation statement is prepended to the compiled code so
4459
+ * that the specified flags take effect for this component at runtime.
4460
+ */
4461
+ buildOverrides?: BuildOverrides;
4324
4462
  }
4325
- type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | string | undefined;
4463
+ /**
4464
+ * Keys of {@link BuildConditionals} that can be meaningfully overridden at
4465
+ * transpile time — config-driven flags that are not derived from component
4466
+ * scanning or runtime environment detection.
4467
+ */
4468
+ type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
4469
+ /**
4470
+ * Subset of Stencil's BUILD feature flags that can be overridden at transpile
4471
+ * time. Derived from {@link BuildConditionals} via `Pick` so the field list
4472
+ * and types stay in sync with the authoritative definition.
4473
+ */
4474
+ type BuildOverrides = Pick<BuildConditionals, BuildOverrideKeys>;
4475
+ type CompileTarget = 'latest' | 'esnext' | 'es2022' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | string | undefined;
4326
4476
  interface TranspileResults {
4327
4477
  code: string;
4328
4478
  data?: any[];
@@ -4348,9 +4498,16 @@ interface TransformOptions {
4348
4498
  styleImportData: 'queryparams' | null;
4349
4499
  target?: string;
4350
4500
  /**
4351
- * @see {@link TranspileOptions.extraFiles}
4501
+ * @see {@link TranspileOptions.resolveImport}
4352
4502
  */
4353
- extraFiles?: Record<string, string>;
4503
+ resolveImport?: (specifier: string, importer: string) => {
4504
+ code: string;
4505
+ path: string;
4506
+ } | null;
4507
+ /** @see {@link TranspileOptions.transformAsBaseClass} */
4508
+ transformAsBaseClass?: boolean;
4509
+ /** @see {@link TranspileOptions.buildOverrides} */
4510
+ buildOverrides?: BuildOverrides;
4354
4511
  }
4355
4512
  interface CompileScriptMinifyOptions {
4356
4513
  target?: CompileTarget;
@@ -4371,4 +4528,4 @@ interface CliInitOptions {
4371
4528
  sys: CompilerSystem;
4372
4529
  }
4373
4530
  //#endregion
4374
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, ValidatedOutputTargetWww, WatcherCloseResults, WorkerMainController, WorkerOptions };
4531
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildOverrides, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, DocsReadmeCustomColumn, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, 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, 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 };
@@ -1,3 +1,5 @@
1
+ import "rolldown";
2
+ import "typescript";
1
3
  //#region src/declarations/stencil-private.d.ts
2
4
  /**
3
5
  * Information about a type used in a Stencil component or exported
@@ -123,6 +125,13 @@ interface JsonDocs {
123
125
  * The metadata for the JSDocs for each component in a Stencil project
124
126
  */
125
127
  components: JsonDocsComponent[];
128
+ /**
129
+ * Project-level usage content, collected from markdown files in a `usage`
130
+ * directory at the project's {@link Config.srcDir} root (as opposed to
131
+ * per-component usage content, which lives in {@link JsonDocsComponent.usage}).
132
+ * Keyed by file name (without extension), same shape as component usage.
133
+ */
134
+ usage?: JsonDocsUsage;
126
135
  /**
127
136
  * The timestamp at which the metadata was generated, in the format YYYY-MM-DDThh:mm:ss
128
137
  */