pdfkit/rollup.config.js
Jake Holland 033ba3426b
Add support for tables (#1577)
* Add page size utilities

- Added page.contentWidth
- Added page.contentHeight

* Add table support

- Tables support cell customization (including colors)
- Tables also support rotatable text (with alignment support)
- Tables have accessibility support

* chore: fix code generation context

- code generation now respects the current document positioning to allow use of page dependent operations

* chore: remove comments from build

* removed unnecessary config optimisations

* Optimize table minification

* Performance improvements to tables

* Improve font handling in tables
2025-02-24 07:49:25 -03:00

118 lines
2.1 KiB
JavaScript

import pkg from './package.json';
import { babel } from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
const external = [
'stream',
'fs',
'zlib',
'fontkit',
'events',
'linebreak',
'png-js',
'crypto-js',
'saslprep',
'jpeg-exif'
];
const supportedBrowsers = [
'Firefox 102', // ESR from 2022
'iOS 14', // from 2020
'Safari 14' // from 2020
];
export default [
// CommonJS build for Node
{
input: 'lib/document.js',
external,
output: {
name: 'pdfkit',
file: pkg.main,
format: 'cjs',
sourcemap: true,
interop: false
},
plugins: [
babel({
babelHelpers: 'bundled',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
node: '18'
}
}
]
],
comments: false
}),
copy({
targets: [
{ src: ['lib/font/data/*.afm', 'lib/mixins/data/*.icc'], dest: 'js/data' },
]
})
]
},
// ES for green browsers
{
input: 'lib/document.js',
external,
output: {
name: 'pdfkit.es',
file: pkg.module,
format: 'es',
sourcemap: true
},
plugins: [
babel({
babelHelpers: 'bundled',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
browsers: supportedBrowsers
}
}
]
],
comments: false
})
]
},
{
input: 'lib/virtual-fs.js',
external,
output: {
name: 'virtual-fs',
file: 'js/virtual-fs.js',
format: 'cjs',
sourcemap: false
},
plugins: [
babel({
babelHelpers: 'bundled',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
loose: true,
modules: false,
targets: {
browsers: supportedBrowsers
}
}
]
]
})
]
}
];