forked from spencermountain/compromise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
90 lines (87 loc) · 2.67 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
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import alias from '@rollup/plugin-alias'
import sizeCheck from 'rollup-plugin-filesize-check'
import { version } from './package.json'
console.log('\n 📦 - running rollup..\n')
const banner = '/* compromise ' + version + ' MIT */'
const noop = __dirname + '/scripts/build/no-ops/_function'
const noobj = __dirname + '/scripts/build/no-ops/_object'
export default [
{
input: 'src/index.js',
output: [{ file: 'builds/compromise-tokenize.js', format: 'umd', sourcemap: false, name: 'nlp' }],
plugins: [
json(),
commonjs(),
babel({
babelrc: false,
presets: ['@babel/preset-env'],
}),
alias({
//remove a bunch of imports with no-ops
entries: [
{ find: './data/conjugations', replacement: noobj },
{ find: './data/plurals', replacement: noobj },
{ find: './data/misc', replacement: noobj },
{ find: '../transforms/conjugate', replacement: noop },
{ find: '../transforms/adjectives', replacement: noop },
{ find: '../transforms/toPlural', replacement: noop },
{ find: '../transforms/toSingular', replacement: noop },
{ find: '../transforms/toInfinitive', replacement: noop },
{ find: './_data', replacement: noobj },
{ find: '../02-tagger', replacement: __dirname + '/src/02-tagger/tiny' },
{ find: 'efrt-unpack', replacement: noop },
],
}),
terser(),
sizeCheck({ expect: 82, warn: 5 }),
],
},
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/compromise.mjs', format: 'esm' }],
plugins: [
resolve(),
json(),
commonjs(),
babel({
babelrc: false,
presets: ['@babel/preset-env'],
}),
sizeCheck({ expect: 330, warn: 10 }),
],
},
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/compromise.js', format: 'umd', sourcemap: false, name: 'nlp' }],
plugins: [
resolve(),
json(),
commonjs(),
babel({
babelrc: false,
presets: ['@babel/preset-env'],
}),
sizeCheck({ expect: 351, warn: 10 }),
],
},
{
input: 'src/index.js',
output: [{ file: 'builds/compromise.min.js', format: 'umd', name: 'nlp' }],
plugins: [
resolve(),
json(),
commonjs(),
babel({
babelrc: false,
presets: ['@babel/preset-env'],
}),
terser(),
sizeCheck({ expect: 173, warn: 10 }),
],
},
]