|
1
|
import { readFileSync } from 'node:fs' |
|
2
|
import { dirname, join } from 'node:path' |
|
3
|
import { cwd } from 'node:process' |
|
4
|
import typescript from '@rollup/plugin-typescript' |
|
5
|
|
|
6
|
const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf8')) |
|
7
|
|
|
8
|
export default { |
|
9
|
input: 'guest-js/index.ts', |
|
10
|
output: [ |
|
11
|
{ |
|
12
|
file: pkg.exports.import, |
|
13
|
format: 'esm' |
|
14
|
}, |
|
15
|
{ |
|
16
|
file: pkg.exports.require, |
|
17
|
format: 'cjs' |
|
18
|
} |
|
19
|
], |
|
20
|
plugins: [ |
|
21
|
typescript({ |
|
22
|
declaration: true, |
|
23
|
declarationDir: dirname(pkg.exports.import) |
|
24
|
}) |
|
25
|
], |
|
26
|
external: [ |
|
27
|
/^@tauri-apps\/api/, |
|
28
|
...Object.keys(pkg.dependencies || {}), |
|
29
|
...Object.keys(pkg.peerDependencies || {}) |
|
30
|
] |
|
31
|
} |