forked from maplibre/maplibre-style-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
105 lines (103 loc) · 2.43 KB
/
rollup.config.ts
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
98
99
100
101
102
103
104
105
import replace from '@rollup/plugin-replace';
import commonjs from '@rollup/plugin-commonjs';
import {RollupOptions} from 'rollup';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json';
import minifyStyleSpec from './build/rollup_plugin_minify_style_spec';
import shebang from 'rollup-plugin-preserve-shebang';
const rollupPlugins = [
minifyStyleSpec(),
json(),
resolve({
browser: true
}),
// https://github.com/zaach/jison/issues/351
replace({
preventAssignment: true,
include: /\/jsonlint-lines-primitives\/lib\/jsonlint.js/,
delimiters: ['', ''],
values: {
'_token_stack:': ''
}
}),
typescript({
compilerOptions: {
declaration: false,
}
}),
commonjs()
];
const config: RollupOptions[] = [{
input: './src/style-spec.ts',
output: [{
file: 'dist/index.mjs',
format: 'es',
sourcemap: true
},
{
name: 'maplibreGlStyleSpecification',
file: 'dist/index.cjs',
format: 'umd',
sourcemap: true,
globals: {
fs: 'fs'
}
}],
plugins: rollupPlugins
},
{
input: './bin/gl-style-format.ts',
output: [{
file: 'dist/gl-style-format.mjs',
format: 'es',
sourcemap: true
},
{
name: 'maplibreGlStyleSpecification',
file: 'dist/gl-style-format.cjs',
format: 'umd',
sourcemap: true,
globals: {
fs: 'fs'
}
}],
plugins: [...rollupPlugins, shebang()]
},
{
input: './bin/gl-style-migrate.ts',
output: [{
file: 'dist/gl-style-migrate.mjs',
format: 'es',
sourcemap: true
},
{
name: 'maplibreGlStyleSpecification',
file: 'dist/gl-style-migrate.cjs',
format: 'umd',
sourcemap: true,
globals: {
fs: 'fs'
}
}],
plugins: [...rollupPlugins, shebang()]
},
{
input: './bin/gl-style-validate.ts',
output: [{
file: 'dist/gl-style-validate.mjs',
format: 'es',
sourcemap: true
},
{
name: 'maplibreGlStyleSpecification',
file: 'dist/gl-style-validate.cjs',
format: 'umd',
sourcemap: true,
globals: {
fs: 'fs'
}
}],
plugins: [...rollupPlugins, shebang()]
}];
export default config;