UNPKG

1.96 kBTypeScriptView Raw
1import type { OutputTargetCustom } from '@stencil/core/internal';
2export interface ReactOutputTargetOptions {
3 /**
4 * Specify the output directory or path where the generated React components will be saved.
5 */
6 outDir: string;
7 /**
8 * Specify the components that should be excluded from the React output target.
9 */
10 excludeComponents?: string[];
11 /**
12 * The package name of the Stencil project.
13 *
14 * This value is automatically detected from the package.json file of the Stencil project.
15 * If the validation fails, you can manually assign the package name.
16 */
17 stencilPackageName?: string;
18 /**
19 * Enables generating the react components as ES modules.
20 * @default false
21 */
22 esModules?: boolean;
23 /**
24 * The directory where the custom elements are saved.
25 *
26 * This value is automatically detected from the Stencil configuration file for the dist-custom-elements output target.
27 * If you are working in an environment that uses absolute paths, consider setting this value manually.
28 */
29 customElementsDir?: string;
30 /**
31 * To enable server side rendering, provide the path to the hydrate module, e.g. `my-component/hydrate`.
32 * By default this value is undefined and server side rendering is disabled.
33 */
34 hydrateModule?: string;
35}
36interface ReactOutputTarget extends OutputTargetCustom {
37 __internal_getCustomElementsDir: () => string;
38}
39/**
40 * Creates an output target for binding Stencil components to be used in a React context
41 * @public
42 * @param outputTarget the user-defined output target defined in a Stencil configuration file
43 * @returns an output target that can be used by the Stencil compiler
44 */
45export declare const reactOutputTarget: ({ outDir, esModules, stencilPackageName, excludeComponents, customElementsDir: customElementsDirOverride, hydrateModule, }: ReactOutputTargetOptions) => ReactOutputTarget;
46export {};