import { Config } from '@stencil/core';
import { reactOutputTarget } from '@stencil/react-output-target';
import { angularOutputTarget } from '@stencil/angular-output-target';
import { vueOutputTarget } from '@stencil/vue-output-target';

export const config: Config = {
  namespace: 'stenci-ai-chat',
  devServer: {
    reloadStrategy: 'pageReload',
    initialLoadUrl: '/',
    port: 3334,
    host: 'localhost'
  },
  outputTargets: [
    {
      type: 'dist',
      esmLoaderPath: '../loader',
    },
    {
      type: 'dist-custom-elements',
      customElementsExportBehavior: 'auto-define-custom-elements',
      externalRuntime: false,
    },
    {
      type: 'dist-hydrate-script',
    },
    reactOutputTarget({
      componentCorePackage: 'hxy-stencil-ai-chat',
      proxiesFile: './react/src/components/stencil-generated/index.ts',
      includeDefineCustomElements: true,
      // 仅生成对外组件的 React 包装，排除内部渲染器
      excludeComponents: [
        'internal-text-renderer',
        'internal-markdown-renderer',
        'internal-echarts-renderer',
        'internal-message-input',
      ],
      outDir: './react',
    }),
    angularOutputTarget({
      componentCorePackage: 'hxy-stencil-ai-chat',
      directivesProxyFile: './angular/src/directives/proxies.ts',
      outDir: './angular',
    }),
    vueOutputTarget({
      componentCorePackage: 'hxy-stencil-ai-chat',
      proxiesFile: './vue/src/components.ts',
      outDir: './vue',
    }),
    {
      type: 'docs-readme',
    },
    {
      type: 'www',
      serviceWorker: null, // disable service workers
    },
  ],
  testing: {
    browserHeadless: "shell",
  },
};
