This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
97 lines (92 loc) · 2.17 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import alias from '@rollup/plugin-alias'
import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import tsconfig from './tsconfig.json'
import typescript from 'rollup-plugin-typescript2'
const extensions = ['.js', '.ts']
const server = {
input: './src/index.ts',
external: ['crypto', 'uuid', 'ws', '@google-cloud/speech', 'node-fetch'],
plugins: [
typescript({
useTsconfigDeclarationDir: true,
tsconfigOverride: {
exclude: tsconfig.exclude.concat('examples'),
compilerOptions: {
declaration: true,
declarationDir: './dist'
}
}
})
],
output: {
banner: `/**
* Custom tools for easy integration with the Spokestack API
* Copyright Spokestack
* https://github.com/spokestack/node-spokestack/blob/develop/MIT-License.txt
*/`,
format: 'cjs',
name: 'Spokestack',
file: 'dist/index.js'
},
watch: {
include: ['src/index.ts', 'src/cookies.ts', 'src/server/**']
}
}
const client = {
input: './src/client.ts',
plugins: [
commonjs(),
nodeResolve({
browser: true,
extensions
}),
typescript({
useTsconfigDeclarationDir: true,
tsconfigOverride: {
exclude: tsconfig.exclude.concat('examples'),
compilerOptions: {
declaration: true,
declarationDir: './dist'
}
}
})
],
output: {
banner: `/**
* Custom tools for recording audio and processing voice on the client
* Copyright Spokestack
* https://github.com/spokestack/node-spokestack/blob/develop/MIT-License.txt
*/`,
format: 'cjs',
file: 'dist/client.js'
},
watch: {
include: ['src/client.ts', 'src/cookies.ts', 'src/client/**']
}
}
const worker = {
input: './src/worker/index.ts',
plugins: [
alias({
entries: {
'@tensorflow/tfjs': './custom_tfjs/custom_tfjs.js'
}
}),
typescript({
tsconfig: 'src/worker/tsconfig.json'
}),
commonjs(),
nodeResolve({
browser: true
})
],
output: {
format: 'iife',
file: 'dist/spokestack-web-worker.js'
},
watch: {
include: ['src/worker/**']
}
}
export default [server, client, worker]