forked from Hopding/pdf-lib
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
57 lines (52 loc) · 4.25 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
const { MINIFY, MODULE_TYPE } = process.env;
const IgnoredWarnings = [
// Mac & Linux
'Circular dependency: es/api/PDFDocument.js -> es/api/PDFFont.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/PDFDocument.js -> es/api/PDFImage.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/PDFDocument.js -> es/api/PDFPage.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/PDFPage.js',
'Circular dependency: es/api/PDFDocument.js -> es/api/PDFEmbeddedPage.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/form/index.js -> es/api/form/PDFButton.js -> es/api/form/PDFField.js -> es/api/PDFDocument.js -> es/api/form/index.js',
'Circular dependency: es/api/form/PDFButton.js -> es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFButton.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFCheckBox.js -> es/api/PDFPage.js',
'Circular dependency: es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFCheckBox.js -> es/api/form/PDFField.js -> es/api/PDFDocument.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFDropdown.js -> es/api/PDFPage.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFOptionList.js -> es/api/PDFPage.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFRadioGroup.js -> es/api/PDFPage.js',
'Circular dependency: es/api/PDFPage.js -> es/api/PDFDocument.js -> es/api/form/PDFForm.js -> es/api/form/PDFTextField.js -> es/api/PDFPage.js',
// Windows
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\PDFFont.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\PDFImage.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\PDFPage.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\PDFPage.js',
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\PDFEmbeddedPage.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\form\\index.js -> es\\api\\form\\PDFButton.js -> es\\api\\form\\PDFField.js -> es\\api\\PDFDocument.js -> es\\api\\form\\index.js',
'Circular dependency: es\\api\\form\\PDFButton.js -> es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFButton.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFCheckBox.js -> es\\api\\PDFPage.js',
'Circular dependency: es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFCheckBox.js -> es\\api\\form\\PDFField.js -> es\\api\\PDFDocument.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFDropdown.js -> es\\api\\PDFPage.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFOptionList.js -> es\\api\\PDFPage.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFRadioGroup.js -> es\\api\\PDFPage.js',
'Circular dependency: es\\api\\PDFPage.js -> es\\api\\PDFDocument.js -> es\\api\\form\\PDFForm.js -> es\\api\\form\\PDFTextField.js -> es\\api\\PDFPage.js',
];
// Silence circular dependency warnings we don't care about
const onwarn = (warning, warn) => {
if (IgnoredWarnings.includes(warning.message)) return;
warn(warning);
};
export default {
onwarn,
input: 'es/index.js',
output: {
name: 'PDFLib',
format: MODULE_TYPE,
sourcemap: true,
},
plugins: [resolve(), commonjs(), json(), MINIFY === 'true' && terser()],
};