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

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 (36) hide show
  1. package/dist/{client-Dti6fFpE.mjs → client-Dnio47yQ.mjs} +81 -10
  2. package/dist/compiler/index.d.mts +2 -2
  3. package/dist/compiler/index.mjs +2 -2
  4. package/dist/compiler/utils/index.d.mts +2 -2
  5. package/dist/compiler/utils/index.mjs +3 -3
  6. package/dist/{compiler-BYRrEeD-.mjs → compiler-Dxri2g8Z.mjs} +15313 -14822
  7. package/dist/declarations/stencil-public-compiler.d.ts +288 -132
  8. package/dist/declarations/stencil-public-compiler.js +2 -3
  9. package/dist/declarations/stencil-public-runtime.d.ts +2 -0
  10. package/dist/{index-hS-KBdAP.d.ts → index-D-XN9HW_.d.ts} +1 -1
  11. package/dist/{index-BwTaN1Nq.d.mts → index-D5zaocDq.d.mts} +357 -189
  12. package/dist/{index-CyrGY82h.d.ts → index-D61XZw0f.d.ts} +2 -2
  13. package/dist/{index-9LTuoSiw.d.mts → index-Dat4djoo.d.mts} +1 -1
  14. package/dist/index.mjs +1 -1
  15. package/dist/{jsx-runtime-DlDkTqps.d.ts → jsx-runtime-B3vQbWIW.d.ts} +1 -1
  16. package/dist/jsx-runtime.d.ts +1 -1
  17. package/dist/jsx-runtime.js +1 -1
  18. package/dist/{node-BF2jSfWg.mjs → node-pj6rF4Wt.mjs} +66 -69
  19. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-D0_N0PGa.mjs} +44 -26
  20. package/dist/runtime/app-data/index.d.ts +1 -1
  21. package/dist/runtime/client/index.d.ts +41 -8
  22. package/dist/runtime/client/index.js +105 -31
  23. package/dist/runtime/index.d.ts +29 -5
  24. package/dist/runtime/index.js +2 -2
  25. package/dist/runtime/server/index.d.mts +56 -25
  26. package/dist/runtime/server/index.mjs +122 -37
  27. package/dist/runtime/server/runner.d.mts +40 -26
  28. package/dist/runtime/server/runner.mjs +28 -22
  29. package/dist/{runtime-COEYYPyw.js → runtime-CKyUrF4i.js} +104 -30
  30. package/dist/sys/node/index.d.mts +1 -1
  31. package/dist/sys/node/index.mjs +1 -1
  32. package/dist/sys/node/worker.mjs +2 -2
  33. package/dist/testing/index.d.mts +2 -2
  34. package/dist/testing/index.mjs +15 -15
  35. package/dist/{validation-Byxie0Uk.mjs → validation-BA8nzXu_.mjs} +82 -58
  36. package/package.json +11 -12
@@ -715,7 +715,7 @@ interface BuildCtx {
715
715
  hasScriptChanges: boolean;
716
716
  hasStyleChanges: boolean;
717
717
  hasWarning: boolean;
718
- hydrateAppFilePath: string;
718
+ ssrAppFilePath: string;
719
719
  indexBuildCount: number;
720
720
  indexDoc: Document;
721
721
  isRebuild: boolean;
@@ -899,7 +899,8 @@ interface CompilerCtx {
899
899
  addWatchFile: (path: string) => void;
900
900
  cache: Cache;
901
901
  cssModuleImports: Map<string, string[]>;
902
- cachedGlobalStyle: string;
902
+ /** Cache of built global styles, keyed by input file path */
903
+ globalStyleCache: Map<string, string>;
903
904
  collections: CollectionCompilerMeta[];
904
905
  compilerOptions: any;
905
906
  events: BuildEvents;
@@ -913,7 +914,7 @@ interface CompilerCtx {
913
914
  moduleMap: ModuleMap;
914
915
  nodeMap: NodeMap;
915
916
  resolvedCollections: Set<string>;
916
- rolldownCacheHydrate: any;
917
+ rolldownCacheSsr: any;
917
918
  rolldownCacheLazy: any;
918
919
  rolldownCacheNative: any;
919
920
  styleModeNames: Set<string>;
@@ -921,6 +922,22 @@ interface CompilerCtx {
921
922
  changedFiles: Set<string>;
922
923
  worker?: CompilerWorkerContext;
923
924
  rolldownCache: Map<string, any>;
925
+ /**
926
+ * Cross-build cache for {@link ts.transpileModule} results.
927
+ * Keyed by `"${bundleId}:${normalizedFilePath}"`. Invalidated for any
928
+ * file that appears in {@link changedModules} after TypeScript re-emits.
929
+ * @see transpileCache in compiler-ctx.ts
930
+ */
931
+ transpileCache: Map<string, {
932
+ outputText: string;
933
+ sourceMapText: string | null;
934
+ }>;
935
+ /**
936
+ * Cross-build cache of the last style text pushed to the HMR client.
937
+ * Keyed by getScopeId result (e.g. "ion-accordion$ios"). Used by
938
+ * extTransformsPlugin to avoid re-pushing unchanged styles on every rebuild.
939
+ */
940
+ prevStylesMap: Map<string, string>;
924
941
  /**
925
942
  * Cross-output-target cache for the SASS + Lightning CSS computation.
926
943
  * Keyed by the annotated Rolldown import id. Null entries indicate that the
@@ -1433,7 +1450,7 @@ interface PrerenderUrlRequest {
1433
1450
  baseUrl: string;
1434
1451
  componentGraphPath: string;
1435
1452
  devServerHostUrl: string;
1436
- hydrateAppFilePath: string;
1453
+ ssrAppFilePath: string;
1437
1454
  isDebug: boolean;
1438
1455
  prerenderConfigPath: string;
1439
1456
  staticSite: boolean;
@@ -1516,9 +1533,10 @@ interface PackageJsonData {
1516
1533
  browser?: string;
1517
1534
  module?: string;
1518
1535
  'jsnext:main'?: string;
1519
- 'collection:main'?: string;
1520
1536
  unpkg?: string;
1537
+ /** @deprecated Use `stencilRebundle` instead. Kept for reading v4 dependencies. */
1521
1538
  collection?: string;
1539
+ stencilRebundle?: string;
1522
1540
  types?: string;
1523
1541
  files?: string[];
1524
1542
  ['dist-tags']?: {
@@ -1702,11 +1720,6 @@ interface StencilConfig {
1702
1720
  * (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
1703
1721
  */
1704
1722
  suppressReservedPublicNameWarnings?: boolean;
1705
- /**
1706
- * When `true`, we will validate a project's `package.json` based on the output target the user has designated
1707
- * as `isPrimaryPackageOutputTarget: true` in their Stencil config.
1708
- */
1709
- validatePrimaryPackageOutputTarget?: boolean;
1710
1723
  /**
1711
1724
  * Passes custom configuration down to the "@rolldown/plugin-node-resolve" that Stencil uses under the hood.
1712
1725
  * For further information: https://stenciljs.com/docs/module-bundling
@@ -1726,13 +1739,6 @@ interface StencilConfig {
1726
1739
  * Defaults to `false` in dev mode and `true` in production mode.
1727
1740
  */
1728
1741
  minifyCss?: boolean;
1729
- /**
1730
- * Forces Stencil to run in `dev` mode if the value is `true` and `production` mode
1731
- * if it's `false`.
1732
- *
1733
- * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
1734
- */
1735
- devMode?: boolean;
1736
1742
  /**
1737
1743
  * Object to provide a custom logger. By default a `logger` is already provided for the
1738
1744
  * platform the compiler is running on, such as NodeJS or a browser.
@@ -1808,14 +1814,6 @@ interface StencilConfig {
1808
1814
  after?: any[];
1809
1815
  };
1810
1816
  entryComponentsHint?: string[];
1811
- /**
1812
- * Sets whether Stencil will write files to `dist/` during the build or not.
1813
- *
1814
- * By default this value is set to the opposite value of {@link devMode},
1815
- * i.e. it will be `true` when building for production and `false` when
1816
- * building for development.
1817
- */
1818
- buildDist?: boolean;
1819
1817
  buildLogFilePath?: string;
1820
1818
  devInspector?: boolean;
1821
1819
  devServer?: StencilDevServerConfig;
@@ -1843,7 +1841,7 @@ interface StencilConfig {
1843
1841
  * An array of component tag names to exclude from production builds.
1844
1842
  * Useful to remove test, demo or experimental components from final output.
1845
1843
  *
1846
- * **Note:** Exclusion only applies to production builds (default, or when `--prod` is used).
1844
+ * **Note:** Exclusion only applies to production builds (the default).
1847
1845
  * Development builds (with `--dev` flag) will include all components to support local testing.
1848
1846
  *
1849
1847
  * Supports glob patterns for matching multiple components:
@@ -1899,20 +1897,6 @@ interface ConfigExtrasBase {
1899
1897
  * Defaults to `false`.
1900
1898
  */
1901
1899
  experimentalScopedSlotChanges?: boolean;
1902
- /**
1903
- * By default Stencil turns the stylesheet provided to `globalStyle` into a constructable stylesheet
1904
- * and adds it to each component when rendered on the client which can be useful for sharing styles
1905
- * efficiently across components.
1906
- *
1907
- * If you want Stencil to also add the `globalStyle` to each component when rendering on the server
1908
- * then set this to `true`. If your `globalStyle` sheet is large then doing this may bloat the size
1909
- * of your SSR output when using declarative-shadow-dom.
1910
- *
1911
- * Setting this to `false` will prevent Stencil from adding any `globalStyle` to each component.
1912
- *
1913
- * Defaults to `'client'`.
1914
- */
1915
- addGlobalStyleToComponents?: boolean | 'client';
1916
1900
  }
1917
1901
  type ConfigExtrasSlotFixes<ExperimentalFixesEnabled extends boolean, IndividualFlags extends boolean> = {
1918
1902
  /**
@@ -1952,7 +1936,6 @@ type ConfigExtrasSlotFixes<ExperimentalFixesEnabled extends boolean, IndividualF
1952
1936
  type ConfigExtras = ConfigExtrasBase & (ConfigExtrasSlotFixes<true, true> | ConfigExtrasSlotFixes<false, boolean>);
1953
1937
  interface Config extends StencilConfig {
1954
1938
  buildAppCore?: boolean;
1955
- buildDocs?: boolean;
1956
1939
  configPath?: string;
1957
1940
  writeLog?: boolean;
1958
1941
  devServer?: DevServerConfig;
@@ -1966,6 +1949,11 @@ interface Config extends StencilConfig {
1966
1949
  tsWatchOptions?: any;
1967
1950
  _isValidated?: boolean;
1968
1951
  _isTesting?: boolean;
1952
+ /**
1953
+ * Internal flag set when --docs CLI flag is used.
1954
+ * Forces docs output targets to build even in dev mode.
1955
+ */
1956
+ _docsFlag?: boolean;
1969
1957
  /**
1970
1958
  * Whether running in a CI environment (disables interactive features, adjusts worker count)
1971
1959
  */
@@ -2048,7 +2036,7 @@ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
2048
2036
  /**
2049
2037
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2050
2038
  */
2051
- type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devMode' | 'devServer' | 'extras' | 'fsNamespace' | 'hashFileNames' | 'hashedFileNameLength' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths' | 'validatePrimaryPackageOutputTarget'>;
2039
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'extras' | 'fsNamespace' | 'hashFileNames' | 'hashedFileNameLength' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2052
2040
  /**
2053
2041
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2054
2042
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -2056,6 +2044,11 @@ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devMode' | 'devServer
2056
2044
  * validations have occurred at runtime.
2057
2045
  */
2058
2046
  type ValidatedConfig = RequireFields<Config, StrictConfigFields> & {
2047
+ /**
2048
+ * Whether the build is running in development mode.
2049
+ * Set by the `--dev` CLI flag. Not user-configurable in `stencil.config.ts`.
2050
+ */
2051
+ devMode: boolean;
2059
2052
  sourceMap: boolean;
2060
2053
  };
2061
2054
  interface HydratedFlag {
@@ -2260,11 +2253,11 @@ interface PrerenderConfig {
2260
2253
  * Run after each `document` is hydrated, but before it is serialized
2261
2254
  * into an HTML string. Hook is passed the `document` and its `URL`.
2262
2255
  */
2263
- afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2256
+ afterSsr?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
2264
2257
  /**
2265
2258
  * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
2266
2259
  */
2267
- beforeHydrate?(document: Document, url: URL): any | Promise<any>;
2260
+ beforeSsr?(document: Document, url: URL): any | Promise<any>;
2268
2261
  /**
2269
2262
  * Runs after the template Document object has serialize into an
2270
2263
  * HTML formatted string. Returns an HTML string to be used as the
@@ -2308,9 +2301,9 @@ interface PrerenderConfig {
2308
2301
  */
2309
2302
  filePath?(url: URL, filePath: string): string;
2310
2303
  /**
2311
- * Returns the hydrate options to use for each individual prerendered page.
2304
+ * Returns the prerender options to use for each individual prerendered page.
2312
2305
  */
2313
- hydrateOptions?(url: URL): PrerenderHydrateOptions;
2306
+ prerenderOptions?(url: URL): PrerenderOptions;
2314
2307
  /**
2315
2308
  * Returns the template file's content. The template is the base
2316
2309
  * HTML used for all prerendered pages.
@@ -2334,7 +2327,7 @@ interface PrerenderConfig {
2334
2327
  */
2335
2328
  trailingSlash?: boolean;
2336
2329
  }
2337
- interface HydrateDocumentOptions {
2330
+ interface SsrDocumentOptions {
2338
2331
  /**
2339
2332
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
2340
2333
  * a random ID will be generated
@@ -2351,7 +2344,7 @@ interface HydrateDocumentOptions {
2351
2344
  * JavaScript to read the structure of the HTML and rebuild each
2352
2345
  * component. Defaults to `true`.
2353
2346
  */
2354
- clientHydrateAnnotations?: boolean;
2347
+ clientSsrAnnotations?: boolean;
2355
2348
  /**
2356
2349
  * Constrain `setTimeout()` to 1ms, but still async. Also
2357
2350
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -2450,10 +2443,19 @@ interface HydrateDocumentOptions {
2450
2443
  default: 'declarative-shadow-dom' | 'scoped';
2451
2444
  } | boolean;
2452
2445
  }
2453
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
2446
+ /**
2447
+ * Backwards compat for v4
2448
+ * @deprecated - use SsrDocumentOptions instead
2449
+ */
2450
+ interface HydrateDocumentOptions extends SsrDocumentOptions {}
2451
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
2454
2452
  /**
2455
2453
  * Runs after the `document` has been hydrated.
2456
2454
  */
2455
+ afterSsr?(document: any): any | Promise<any>;
2456
+ /**
2457
+ * @deprecated Use `afterSsr` instead.
2458
+ */
2457
2459
  afterHydrate?(document: any): any | Promise<any>;
2458
2460
  /**
2459
2461
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -2466,6 +2468,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2466
2468
  /**
2467
2469
  * Runs before the `document` has been hydrated.
2468
2470
  */
2471
+ beforeSsr?(document: any): any | Promise<any>;
2472
+ /**
2473
+ * @deprecated Use `beforeSsr` instead.
2474
+ */
2469
2475
  beforeHydrate?(document: any): any | Promise<any>;
2470
2476
  /**
2471
2477
  * Format the HTML in a nicely indented format.
@@ -2503,12 +2509,17 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
2503
2509
  */
2504
2510
  modes?: ResolutionHandler[];
2505
2511
  }
2506
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
2512
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
2507
2513
  serializeToHtml: boolean;
2508
2514
  destroyWindow: boolean;
2509
2515
  destroyDocument: boolean;
2510
2516
  }
2511
- interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2517
+ /**
2518
+ * Backwards compat for v4
2519
+ * @deprecated - use SsrFactoryOptions instead
2520
+ */
2521
+ interface HydrateFactoryOptions extends SsrFactoryOptions {}
2522
+ interface PrerenderOptions extends SerializeDocumentOptions {
2512
2523
  /**
2513
2524
  * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
2514
2525
  * Defaults to `true`.
@@ -2543,6 +2554,11 @@ interface PrerenderHydrateOptions extends SerializeDocumentOptions {
2543
2554
  */
2544
2555
  staticDocument?: boolean;
2545
2556
  }
2557
+ /**
2558
+ * v4 backwards compat
2559
+ * @deprecated - use PrerenderOptions instead
2560
+ */
2561
+ interface PrerenderHydrateOptions extends PrerenderOptions {}
2546
2562
  interface RobotsTxtOpts {
2547
2563
  urls: string[];
2548
2564
  sitemapUrl: string;
@@ -2940,7 +2956,7 @@ interface CompilerBuildResults {
2940
2956
  hasError: boolean;
2941
2957
  hasSuccessfulBuild: boolean;
2942
2958
  hmr?: HotModuleReplacement;
2943
- hydrateAppFilePath?: string;
2959
+ ssrAppFilePath?: string;
2944
2960
  isRebuild: boolean;
2945
2961
  namespace: string;
2946
2962
  outputs: BuildOutput[];
@@ -3103,8 +3119,8 @@ interface ConfigBundle {
3103
3119
  }
3104
3120
  /**
3105
3121
  * A file and/or directory copy operation that may be specified as part of
3106
- * certain output targets for Stencil (in particular `dist`,
3107
- * `dist-custom-elements`, and `www`).
3122
+ * certain output targets for Stencil (in particular `loader-bundle`,
3123
+ * `standalone`, and `www`).
3108
3124
  */
3109
3125
  interface CopyTask {
3110
3126
  /**
@@ -3302,57 +3318,69 @@ interface LoggerTimeSpan {
3302
3318
  duration(): number;
3303
3319
  finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
3304
3320
  }
3305
- interface OutputTargetDist extends OutputTargetValidationConfig {
3306
- type: 'dist';
3307
- buildDir?: string;
3308
- collectionDir?: string | null;
3309
- /**
3310
- * When `true` this flag will transform aliased import paths defined in
3311
- * a project's `tsconfig.json` to relative import paths in the compiled output's
3312
- * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
3313
- *
3314
- * Paths will be left in aliased format if `false`.
3315
- *
3316
- * @example
3317
- * // tsconfig.json
3318
- * {
3319
- * paths: {
3320
- * "@utils/*": ['/src/utils/*']
3321
- * }
3322
- * }
3323
- *
3324
- * // Source file
3325
- * import * as dateUtils from '@utils/date-utils';
3326
- * // Output file
3327
- * import * as dateUtils from '../utils/date-utils';
3328
- */
3329
- transformAliasedImportPathsInCollection?: boolean | null;
3330
- typesDir?: string;
3321
+ /**
3322
+ * Output target for generating lazy-loaded component bundles with a loader infrastructure.
3323
+ * This creates an optimized distribution for CDN usage and applications that benefit from
3324
+ * lazy-loading components on demand.
3325
+ *
3326
+ * Formerly known as 'dist' in v4.
3327
+ *
3328
+ * @example
3329
+ * ```typescript
3330
+ * {
3331
+ * type: 'loader-bundle',
3332
+ * dir: 'dist/loader-bundle'
3333
+ * }
3334
+ * ```
3335
+ */
3336
+ interface OutputTargetLoaderBundle extends OutputTargetBaseNext {
3337
+ type: 'loader-bundle';
3331
3338
  /**
3332
- * Provide a custom path for the ESM loader directory, containing files you can import
3333
- * in an initiation script within your application to register all your components for
3334
- * lazy loading.
3335
- *
3336
- * @default /dist/loader
3339
+ * Directory where lazy-loaded bundles will be written.
3340
+ * @default '' (root of output directory)
3337
3341
  */
3338
- esmLoaderPath?: string;
3342
+ buildDir?: string;
3339
3343
  copy?: CopyTask[];
3340
3344
  empty?: boolean;
3341
3345
  /**
3342
3346
  * Whether to generate CommonJS (CJS) bundles.
3343
3347
  *
3344
- * When `true`, generates CJS output in `dist/cjs/` and `dist/index.cjs.js`.
3348
+ * When `true`, generates CJS output in `cjs/` subdirectory.
3345
3349
  * When `false` (default in v5+), only ESM bundles are generated.
3346
3350
  *
3347
3351
  * @default false
3348
3352
  */
3349
3353
  cjs?: boolean;
3354
+ /**
3355
+ * Custom path for the loader directory; files you can import
3356
+ * in an initiation script within your application to register all your components for
3357
+ * lazy loading.
3358
+ *
3359
+ * @default 'loader' (relative to output directory)
3360
+ */
3361
+ loaderPath?: string;
3350
3362
  }
3351
- interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3352
- type: 'dist-collection';
3363
+ /**
3364
+ * Output target for generating Stencil component source for downstream re-bundling.
3365
+ * This output contains transpiled source code, component metadata, and configuration
3366
+ * that downstream Stencil projects can re-compile and bundle.
3367
+ *
3368
+ * Formerly 'dist-collection' sub-output in v4, now a first-class output target in v5.
3369
+ *
3370
+ * In production builds, this output is auto-generated unless explicitly configured.
3371
+ *
3372
+ * @example
3373
+ * ```typescript
3374
+ * {
3375
+ * type: 'stencil-rebundle',
3376
+ * dir: 'dist/stencil-rebundle',
3377
+ * transformAliasedImportPaths: true
3378
+ * }
3379
+ * ```
3380
+ */
3381
+ interface OutputTargetStencilRebundle extends OutputTargetBaseNext {
3382
+ type: 'stencil-rebundle';
3353
3383
  empty?: boolean;
3354
- dir: string;
3355
- collectionDir: string;
3356
3384
  /**
3357
3385
  * When `true` this flag will transform aliased import paths defined in
3358
3386
  * a project's `tsconfig.json` to relative import paths in the compiled output.
@@ -3374,10 +3402,25 @@ interface OutputTargetDistCollection extends OutputTargetValidationConfig {
3374
3402
  */
3375
3403
  transformAliasedImportPaths?: boolean | null;
3376
3404
  }
3377
- interface OutputTargetDistTypes extends OutputTargetValidationConfig {
3378
- type: 'dist-types';
3379
- dir: string;
3380
- typesDir: string;
3405
+ /**
3406
+ * Output target for generating TypeScript type definitions (.d.ts files).
3407
+ *
3408
+ * Formerly a sub-output of 'dist' and 'dist-custom-elements' in v4,
3409
+ * now a first-class output target in v5 that can be shared across multiple outputs.
3410
+ *
3411
+ * In production builds, this output is auto-generated unless explicitly configured.
3412
+ *
3413
+ * @example
3414
+ * ```typescript
3415
+ * {
3416
+ * type: 'types',
3417
+ * dir: 'dist/types'
3418
+ * }
3419
+ * ```
3420
+ */
3421
+ interface OutputTargetTypes extends OutputTargetBaseNext {
3422
+ type: 'types';
3423
+ empty?: boolean;
3381
3424
  }
3382
3425
  interface OutputTargetDistLazy extends OutputTargetBase {
3383
3426
  type: 'dist-lazy';
@@ -3387,22 +3430,100 @@ interface OutputTargetDistLazy extends OutputTargetBase {
3387
3430
  isBrowserBuild?: boolean;
3388
3431
  esmIndexFile?: string;
3389
3432
  cjsIndexFile?: string;
3433
+ loaderDir?: string;
3434
+ typesDir?: string;
3390
3435
  empty?: boolean;
3391
3436
  }
3392
- interface OutputTargetDistGlobalStyles extends OutputTargetBase {
3393
- type: 'dist-global-styles';
3394
- file: string;
3437
+ /**
3438
+ * Output target for global styles.
3439
+ * Generates a CSS file from an input stylesheet.
3440
+ *
3441
+ * Can be configured in two ways:
3442
+ * 1. **Implicit** (backwards compat): Set `globalStyle` in the config and this output is auto-generated
3443
+ * 2. **Explicit**: Define this output target with an `input` property
3444
+ *
3445
+ * Multiple `global-style` outputs are supported for building separate CSS bundles.
3446
+ *
3447
+ * @example
3448
+ * ```typescript
3449
+ * // Explicit configuration with custom input/output
3450
+ * {
3451
+ * type: 'global-style',
3452
+ * input: './src/theme.css',
3453
+ * fileName: 'theme.css',
3454
+ * dir: 'dist/assets',
3455
+ * copyToLoaderBrowser: false
3456
+ * }
3457
+ * ```
3458
+ */
3459
+ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
3460
+ type: 'global-style';
3461
+ /**
3462
+ * Path to the input CSS file to compile.
3463
+ * When specified, this takes precedence over the `globalStyle` config option.
3464
+ *
3465
+ * If neither `input` nor `globalStyle` config is set, no CSS will be built.
3466
+ */
3467
+ input?: string;
3468
+ /**
3469
+ * Output filename for the compiled CSS.
3470
+ * @default '{namespace}.css' when using globalStyle config, or basename of input file
3471
+ */
3472
+ fileName?: string;
3473
+ /**
3474
+ * When `true`, also copies the global style CSS to the loader-bundle browser directory
3475
+ * for backwards compatibility with existing CDN consumers who have hardcoded CSS paths.
3476
+ *
3477
+ * @default true
3478
+ */
3479
+ copyToLoaderBrowser?: boolean;
3480
+ /**
3481
+ * Controls whether this global stylesheet is injected into component shadow DOMs
3482
+ * as a constructable stylesheet at runtime.
3483
+ *
3484
+ * - `'none'` (default): Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
3485
+ * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
3486
+ * - `'all'`: Inject in both client and SSR builds
3487
+ *
3488
+ * @default 'none'
3489
+ */
3490
+ inject?: 'none' | 'client' | 'all';
3395
3491
  }
3396
- interface OutputTargetDistLazyLoader extends OutputTargetBase {
3397
- type: 'dist-lazy-loader';
3398
- dir: string;
3399
- esmDir: string;
3400
- cjsDir?: string;
3401
- componentDts: string;
3402
- empty: boolean;
3492
+ /**
3493
+ * Output target for component assets.
3494
+ * Copies all component `assetsDirs` to a unified location.
3495
+ *
3496
+ * auto-generated when components have `assetsDirs` unless explicitly configured.
3497
+ * The output is placed in `dist/assets/` by default and is available to all distribution strategies.
3498
+ *
3499
+ * @example
3500
+ * ```typescript
3501
+ * {
3502
+ * type: 'assets',
3503
+ * dir: 'dist/assets'
3504
+ * }
3505
+ * ```
3506
+ */
3507
+ interface OutputTargetAssets extends OutputTargetBaseNext {
3508
+ type: 'assets';
3403
3509
  }
3404
- interface OutputTargetHydrate extends OutputTargetBase {
3405
- type: 'dist-hydrate-script';
3510
+ /**
3511
+ * Output target for server-side rendering (SSR) and hydration.
3512
+ * Generates a script that can be used for SSR and static site generation (prerendering).
3513
+ *
3514
+ * Formerly known as 'dist-hydrate-script' in v4.
3515
+ *
3516
+ * @example
3517
+ * ```typescript
3518
+ * {
3519
+ * type: 'ssr',
3520
+ * dir: 'dist/ssr',
3521
+ * minify: true
3522
+ * }
3523
+ * ```
3524
+ */
3525
+ interface OutputTargetSsr extends OutputTargetBase {
3526
+ type: 'ssr';
3406
3527
  dir?: string;
3407
3528
  /**
3408
3529
  * Module IDs that should not be bundled into the script.
@@ -3523,14 +3644,13 @@ interface OutputTargetStats extends OutputTargetBase {
3523
3644
  type: 'stats';
3524
3645
  file?: string;
3525
3646
  }
3526
- interface OutputTargetBaseNext {
3527
- type: string;
3647
+ interface OutputTargetBaseNext extends OutputTargetBase {
3528
3648
  dir?: string;
3529
3649
  }
3530
3650
  /**
3531
3651
  * The collection of valid export behaviors.
3532
3652
  * Used to generate a type for typed configs as well as output target validation
3533
- * for the `dist-custom-elements` output target.
3653
+ * for the `standalone` output target.
3534
3654
  *
3535
3655
  * Adding a value to this const array will automatically add it as a valid option on the
3536
3656
  * output target configuration for `customElementsExportBehavior`.
@@ -3539,8 +3659,7 @@ interface OutputTargetBaseNext {
3539
3659
  * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
3540
3660
  * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
3541
3661
  * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
3542
- * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
3543
- * from `dist-custom-elements-bundle` to `dist-custom-elements`.
3662
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory.
3544
3663
  * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
3545
3664
  */
3546
3665
  declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
@@ -3549,23 +3668,40 @@ declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-de
3549
3668
  * This is used on the output target config for intellisense in typed configs.
3550
3669
  */
3551
3670
  type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
3552
- interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3553
- type: 'dist-custom-elements';
3671
+ /**
3672
+ * Output target for generating standalone component modules.
3673
+ * Each component is output as an individual ES module that can be directly imported.
3674
+ *
3675
+ * This output target is ideal for npm consumption and tree-shaking, as consumers
3676
+ * can import only the components they need.
3677
+ *
3678
+ * Formerly known as 'dist-custom-elements' in v4.
3679
+ *
3680
+ * @example
3681
+ * ```typescript
3682
+ * {
3683
+ * type: 'standalone',
3684
+ * dir: 'dist/standalone',
3685
+ * externalRuntime: true,
3686
+ * autoLoader: true
3687
+ * }
3688
+ * ```
3689
+ */
3690
+ interface OutputTargetStandalone extends OutputTargetBaseNext {
3691
+ type: 'standalone';
3554
3692
  empty?: boolean;
3555
3693
  /**
3556
3694
  * Triggers the following behaviors when enabled:
3557
3695
  * 1. All `@stencil/core/*` module references are treated as external during bundling.
3558
3696
  * 2. File names are not hashed.
3559
3697
  * 3. File minification will follow the behavior defined at the root of the Stencil config.
3698
+ *
3699
+ * @default true
3560
3700
  */
3561
3701
  externalRuntime?: boolean;
3562
3702
  copy?: CopyTask[];
3563
3703
  includeGlobalScripts?: boolean;
3564
3704
  minify?: boolean;
3565
- /**
3566
- * Enables the generation of type definition files for the output target.
3567
- */
3568
- generateTypeDeclarations?: boolean;
3569
3705
  /**
3570
3706
  * Define the export/definition behavior for the output target's generated output.
3571
3707
  * This controls if/how custom elements will be defined or where components will be exported from.
@@ -3576,6 +3712,8 @@ interface OutputTargetDistCustomElements extends OutputTargetValidationConfig {
3576
3712
  * Generate an auto-loader script that uses MutationObserver to lazily load
3577
3713
  * and define custom elements as they appear in the DOM.
3578
3714
  *
3715
+ * @default true
3716
+ *
3579
3717
  * When set to `true`, generates a `loader.js` file that auto-starts on import.
3580
3718
  * Can also be configured with an object for more control:
3581
3719
  * - `fileName`: Custom filename for the loader (default: 'loader.js')
@@ -3615,27 +3753,45 @@ interface OutputTargetBase {
3615
3753
  * A unique string to differentiate one output target from another
3616
3754
  */
3617
3755
  type: string;
3756
+ /**
3757
+ * When `true`, this output target will be skipped during development builds (`--dev`).
3758
+ * This improves dev build times by not generating production-only artifacts.
3759
+ *
3760
+ * Defaults vary by output target type:
3761
+ * - `loader-bundle`: `false` (always builds)
3762
+ * - `standalone`: `true` (skips in dev)
3763
+ * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
3764
+ * - `docs-*`: `true` (skips in dev)
3765
+ * - `custom`: `true` (skips in dev)
3766
+ * - `www`, `copy`, `stats`: `false` (always runs)
3767
+ */
3768
+ skipInDev?: boolean;
3618
3769
  }
3619
- /**
3620
- * Output targets that can have validation for common `package.json` field values
3621
- * (module, types, etc.). This allows them to be marked for validation in a project's Stencil config.
3622
- */
3623
- interface OutputTargetValidationConfig extends OutputTargetBaseNext {
3624
- isPrimaryPackageOutputTarget?: boolean;
3625
- }
3626
- type EligiblePrimaryPackageOutputTarget = OutputTargetDist | OutputTargetDistCustomElements | OutputTargetDistCollection | OutputTargetDistTypes;
3627
- type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
3770
+ type OutputTargetBuild = OutputTargetStencilRebundle | OutputTargetDistLazy;
3628
3771
  interface OutputTargetCopy extends OutputTargetBase {
3629
3772
  type: 'copy';
3630
3773
  dir: string;
3631
3774
  copy?: CopyTask[];
3632
- copyAssets?: 'collection' | 'dist';
3633
3775
  }
3634
3776
  interface OutputTargetWww extends OutputTargetBase {
3635
3777
  /**
3636
3778
  * Webapp output target.
3637
3779
  */
3638
3780
  type: 'www';
3781
+ /**
3782
+ * Choose how components are bundled for the www output.
3783
+ *
3784
+ * - `'loader'` (default): Uses the loader-bundle architecture with chunk
3785
+ * splitting and a loader infrastructure. Best for production apps with many
3786
+ * components where you want optimal loading performance.
3787
+ *
3788
+ * - `'standalone'`: Uses standalone component modules with an auto-loader that
3789
+ * uses MutationObserver to dynamically import components as they appear in
3790
+ * the DOM. Simpler architecture, easier debugging, one module per component.
3791
+ *
3792
+ * Default: `'loader'`
3793
+ */
3794
+ bundleMode?: 'loader' | 'standalone';
3639
3795
  /**
3640
3796
  * The directory to write the app's JavaScript and CSS build
3641
3797
  * files to. The default is to place this directory as a child
@@ -3682,7 +3838,7 @@ interface OutputTargetWww extends OutputTargetBase {
3682
3838
  * Path to an external node module which has exports of the prerender config object.
3683
3839
  * ```
3684
3840
  * module.exports = {
3685
- * afterHydrate(document, url) {
3841
+ * afterSsr(document, url) {
3686
3842
  * document.title = `URL: ${url.href}`;
3687
3843
  * }
3688
3844
  * }
@@ -3698,7 +3854,7 @@ interface OutputTargetWww extends OutputTargetBase {
3698
3854
  serviceWorker?: ServiceWorkerConfig | null | false;
3699
3855
  appDir?: string;
3700
3856
  }
3701
- type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
3857
+ type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetLoaderBundle | OutputTargetStandalone | OutputTargetSsr | OutputTargetStencilRebundle | OutputTargetTypes | OutputTargetGlobalStyle | OutputTargetAssets | OutputTargetDistLazy | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetDocsCustomElementsManifest | OutputTargetWww | OutputTargetStats;
3702
3858
  /**
3703
3859
  * Our custom configuration interface for generated caching Service Workers
3704
3860
  * using the Workbox library (see https://developer.chrome.com/docs/workbox/).
@@ -3810,7 +3966,7 @@ interface ResolveModuleOptions {
3810
3966
  }
3811
3967
  interface PrerenderStartOptions {
3812
3968
  buildId?: string;
3813
- hydrateAppFilePath?: string;
3969
+ ssrAppFilePath?: string;
3814
3970
  componentGraph?: BuildResultsComponentGraph;
3815
3971
  srcIndexHtmlPath?: string;
3816
3972
  }
@@ -4082,4 +4238,4 @@ interface CliInitOptions {
4082
4238
  sys: CompilerSystem;
4083
4239
  }
4084
4240
  //#endregion
4085
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, EligiblePrimaryPackageOutputTarget, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCopy, OutputTargetCustom, OutputTargetDist, OutputTargetDistCollection, OutputTargetDistCustomElements, OutputTargetDistGlobalStyles, OutputTargetDistLazy, OutputTargetDistLazyLoader, OutputTargetDistTypes, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetHydrate, OutputTargetStats, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, RolldownInputOptions, RolldownInterface, RolldownOutputOptions, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };
4241
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildResultsComponentGraph, CacheStorage, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigExtras, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, FsWatchResults, HistoryApiFallback, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetStandalone, OutputTargetStats, OutputTargetStencilRebundle, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, RolldownInputOptions, RolldownInterface, RolldownOutputOptions, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, WatcherCloseResults, WorkerMainController, WorkerOptions };