* feat(askai): Split Ask AI modal into own component * refactor(react): share modal utilities * refactor(react): share search box form * refactor(react): extract start screen sections * refactor(react): extract shared modal hooks * fix: lint adapter * refactor(react): reorganize modal files * fix: type error in examples * fix: remove ai modal from adapter for now, fix import paths of react package
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import type { UserConfig } from 'tsdown';
|
|
import { defineConfig } from 'tsdown';
|
|
|
|
import { getBundleBanner } from '../../scripts/getBundleBanner';
|
|
import { rolldownPlugins } from '../../tsdown.base';
|
|
|
|
import pkg from './package.json' with { type: 'json' };
|
|
|
|
const externals = ['react', 'react-dom', '@docsearch/core'];
|
|
|
|
const sharedConfig: UserConfig = {
|
|
platform: 'neutral',
|
|
external: externals,
|
|
target: 'es2017',
|
|
minify: true,
|
|
plugins: rolldownPlugins,
|
|
sourcemap: true,
|
|
outExtensions: () => ({
|
|
dts: '.js',
|
|
js: '.js',
|
|
}),
|
|
};
|
|
|
|
export default defineConfig([
|
|
{
|
|
entry: {
|
|
index: 'src/index.ts',
|
|
DocSearchAI: 'src/DocSearchAI.tsx',
|
|
DocSearchAskAiModal: 'src/DocSearchAskAiModal.tsx',
|
|
DocSearchButton: 'src/DocSearchButton.tsx',
|
|
DocSearchModal: 'src/DocSearchModal.tsx',
|
|
useDocSearchKeyboardEvents: 'src/useDocSearchKeyboardEvents.ts',
|
|
useTheme: 'src/useTheme.tsx',
|
|
version: 'src/version.ts',
|
|
Sidepanel: 'src/Sidepanel.tsx',
|
|
},
|
|
...sharedConfig,
|
|
outDir: 'dist/esm',
|
|
},
|
|
{
|
|
entry: 'src/index.ts',
|
|
outDir: 'dist/umd',
|
|
...sharedConfig,
|
|
banner: getBundleBanner(pkg),
|
|
outputOptions: {
|
|
entryFileNames: '[name].js',
|
|
name: 'DocSearchReact',
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'@docsearch/core': 'DocSearchCore',
|
|
},
|
|
},
|
|
format: 'umd',
|
|
},
|
|
]);
|