File tree 4 files changed +1096
-571
lines changed
4 files changed +1096
-571
lines changed Original file line number Diff line number Diff line change 31
31
" dist"
32
32
],
33
33
"scripts" : {
34
- "build" : " unbuild" ,
34
+ "build" : " pnpm build:unbuild & pnpm build:rollup" ,
35
+ "build:unbuild" : " unbuild" ,
36
+ "build:rollup" : " rollup -c rollup.config.js" ,
35
37
"dev" : " unbuild --stub" ,
36
38
"lint" : " eslint ." ,
37
39
"lint:fix" : " eslint . --fix" ,
51
53
"devDependencies" : {
52
54
"@antfu/eslint-config" : " ^2.16.0" ,
53
55
"@antfu/ni" : " ^0.21.12" ,
56
+ "@rollup/plugin-commonjs" : " ^28.0.3" ,
57
+ "@rollup/plugin-node-resolve" : " ^16.0.0" ,
58
+ "@rollup/plugin-terser" : " ^0.4.4" ,
59
+ "@rollup/plugin-typescript" : " ^12.1.1" ,
54
60
"@types/node" : " ^20.12.7" ,
55
61
"@types/react" : " 18.2.23" ,
56
62
"@types/semver" : " ^7.5.8" ,
59
65
"eslint-formatter-mo" : " ^1.2.0" ,
60
66
"lint-staged" : " ^15.2.2" ,
61
67
"rimraf" : " ^5.0.5" ,
68
+ "rollup" : " ^4.27.3" ,
62
69
"tsx" : " ^4.7.3" ,
63
70
"typescript" : " ^5.4.5" ,
64
71
"unbuild" : " ^2.0.0" ,
Original file line number Diff line number Diff line change
1
+ import typescript from '@rollup/plugin-typescript'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import resolve from '@rollup/plugin-node-resolve'
4
+ import terser from '@rollup/plugin-terser'
5
+ import { defineConfig } from 'rollup'
6
+
7
+ export default defineConfig ( [ {
8
+ input : 'src/browser.ts' ,
9
+ output : {
10
+ dir : 'dist' ,
11
+ format : 'iife' ,
12
+ entryFileNames : 'iife/tabby-chat-panel.min.js' ,
13
+ name : 'TabbyChatPanel' ,
14
+ } ,
15
+ treeshake : true ,
16
+ plugins : [
17
+ resolve ( {
18
+ browser : true ,
19
+ } ) ,
20
+ commonjs ( ) ,
21
+ terser ( ) ,
22
+ typescript ( {
23
+ tsconfig : './tsconfig.json' ,
24
+ noEmitOnError : true ,
25
+ } ) ,
26
+ ] ,
27
+ } ] )
Original file line number Diff line number Diff line change
1
+ import { createThreadFromIframe } from 'tabby-threads'
2
+ import { createClient as createClientFromThread } from './thread'
3
+ import type { ClientApi } from './client'
4
+ import type { ServerApi , ServerApiList } from './server'
5
+
6
+ export async function createClient ( iframe : HTMLIFrameElement , api : ClientApi ) : Promise < ServerApiList > {
7
+ const thread = createThreadFromIframe < ClientApi , ServerApi > ( iframe , { expose : api } )
8
+ return await createClientFromThread ( thread )
9
+ }
You can’t perform that action at this time.
0 commit comments