-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.rpc.mjs
57 lines (55 loc) · 1.38 KB
/
rollup.config.rpc.mjs
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
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import execute from 'rollup-plugin-execute'
/**
* We have a internal circular dependency in the compiler,
* which is intentional. We think in this case Rollup is too noisy.
*
* @param {import('rollup').RollupLog} warning
* @returns {boolean}
*/
function isInternalCircularDependency(warning) {
return (
warning.code == 'CIRCULAR_DEPENDENCY' &&
warning.message.includes('src/compiler') &&
!warning.message.includes('node_modules')
)
}
/** @type {import('rollup').RollupOptions} */
export default {
onwarn: (warning, warn) => {
if (!isInternalCircularDependency(warning)) warn(warning)
},
input: 'src/index.rpc.ts',
output: [
{
file: 'dist/promptl.js',
format: 'es',
},
],
plugins: [
nodeResolve({
preferBuiltins: true,
}),
commonjs(),
typescript({
noEmit: true,
tsconfig: './tsconfig.json',
exclude: ['**/__tests__', '**/*.test.ts'],
}),
execute([
[
'javy build',
'-C dynamic=n',
'-C source-compression=y',
'-J javy-stream-io=y',
'-J simd-json-builtins=y',
'-J text-encoding=y',
'-J event-loop=y',
'-o dist/promptl.wasm',
'dist/promptl.js',
].join(' '),
]),
],
}