Skip to content

Commit

Permalink
Drop support for Node.js < 18 and for browsers released before 2020
Browse files Browse the repository at this point in the history
  • Loading branch information
blikblum committed Mar 24, 2024
1 parent 309cdd6 commit 582fc22
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 59 deletions.
6 changes: 3 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"modules": false,
"targets": {
"node": "6.10"
"node": "18"
}
}
]
Expand All @@ -17,11 +17,11 @@
"@babel/preset-env",
{
"targets": {
"node": "6.10"
"node": "18"
}
}
]
]
}
}
}
}
25 changes: 12 additions & 13 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Run ESLint
run: npm run lint
- name: Run tests
run: npm test
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Run ESLint
run: npm run lint
- name: Run tests
run: npm test
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Fix for Acroforms - setting an option to false will still apply the flag (#1495)
- Fix for text extraction in PDFium-based viewers due to invalid ToUnicodeMap (#1498)
- Remove deprecated `write` method
- Drop support for Node.js < 18 and for browsers released before 2020

### [v0.14.0] - 2023-11-09

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@
"test:unit": "jest unit/"
},
"main": "js/pdfkit.js",
"module": "js/pdfkit.es5.js",
"esnext": "js/pdfkit.esnext.js",
"module": "js/pdfkit.es.js",
"browser": "js/pdfkit.es.js",
"browserify": {
"transform": [
"brfs"
]
},
"engine": [
"node >= v6.0.0"
"node >= v18.0.0"
],
"jest": {
"testEnvironment": "jest-environment-jsdom",
Expand All @@ -89,4 +89,4 @@
"<rootDir>/tests/unit/setupTests.js"
]
}
}
}
50 changes: 11 additions & 39 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const external = [
'jpeg-exif'
];

const supportedBrowsers = [
'Firefox 102', // ESR from 2022
'iOS 14', // from 2020
'Safari 14' // from 2020
];

export default [
// CommonJS build for Node
{
Expand All @@ -36,7 +42,7 @@ export default [
{
modules: false,
targets: {
node: '6.10'
node: '18'
}
}
]
Expand All @@ -48,41 +54,13 @@ export default [
})
]
},
// ES for legacy (IE11) browsers
{
input: 'lib/document.js',
external,
output: {
name: 'pdfkit.es5',
file: pkg.module,
format: 'es',
sourcemap: true
},
plugins: [
babel({
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
browsers: ['ie 11']
},
exclude: ['@babel/plugin-transform-typeof-symbol']
}
]
]
})
]
},
// ES for green browsers
{
input: 'lib/document.js',
external,
output: {
name: 'pdfkit.esnext',
file: pkg.esnext,
name: 'pdfkit.es',
file: pkg.module,
format: 'es',
sourcemap: true
},
Expand All @@ -95,13 +73,7 @@ export default [
{
modules: false,
targets: {
browsers: [
'Firefox 57',
'Edge 15',
'Chrome 60',
'iOS 10',
'Safari 10'
]
browsers: supportedBrowsers
}
}
]
Expand All @@ -128,7 +100,7 @@ export default [
loose: true,
modules: false,
targets: {
browsers: ['ie 11']
browsers: supportedBrowsers
}
}
]
Expand Down

0 comments on commit 582fc22

Please sign in to comment.