Skip to content

Commit d97c69e

Browse files
authored
Upgrade dependencies to fix audit issues (#462)
1 parent e2bcb98 commit d97c69e

13 files changed

+8368
-12390
lines changed

.babelrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
last 1 version
2+
> 1%
3+
IE >= 9

babel.config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
[ "@babel/preset-env", {
4+
"useBuiltIns": "usage",
5+
"corejs": { "version": "3.10", "proposals": true }
6+
}]
7+
],
8+
"sourceType": "unambiguous"
9+
}

karma.conf.js

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
// Karma configuration
22

3-
// Load Rollup dependencies
4-
const rollupConfig = {
5-
resolve: require('rollup-plugin-node-resolve'),
6-
commonjs: require('rollup-plugin-commonjs'),
7-
replace: require('rollup-plugin-replace'),
8-
babel: require('rollup-plugin-babel')
9-
}
10-
113
module.exports = function(config) {
124
config.set({
135

@@ -22,11 +14,11 @@ module.exports = function(config) {
2214

2315
// list of files / patterns to load in the browser
2416
files: [
25-
{ pattern: 'src/index.js', watched: false },
17+
{ pattern: 'src/index.js', watched: false, served: true },
18+
{ pattern: 'test/**/*.js', watched: true },
2619
{ pattern: 'test/reference/*.*', included: false, served: true },
2720
{ pattern: require.resolve('pdftest/dist/pdftest.client.min.js'), watched: false },
2821
{ pattern: require.resolve('pdftest/dist/chai-pdftest.min.js'), watched: false },
29-
'test/**/*.js'
3022
],
3123

3224

@@ -39,8 +31,8 @@ module.exports = function(config) {
3931
// preprocess matching files before serving them to the browser
4032
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4133
preprocessors: {
42-
'src/index.js': ['rollup'],
43-
'test/**/*.js': ['rollupTests'],
34+
'src/index.js': ['webpack'],
35+
'test/**/*.js': ['webpackTests'],
4436
},
4537

4638

@@ -91,39 +83,34 @@ module.exports = function(config) {
9183
},
9284

9385

94-
// Rollup preprocessor
95-
// Setup as a normal Rollup config object, just without the input
96-
// It has its own autoWatch behaviour, so Karma's file watcher must be disabled on its files
97-
rollupPreprocessor: {
86+
webpackPreprocessor: {
9887
output: {
99-
name: 'html2pdf',
100-
format: 'iife',
101-
globals: {
102-
jspdf: 'jsPDF',
103-
html2canvas: 'html2canvas'
104-
}
88+
library: 'html2pdf',
89+
libraryExport: 'default',
90+
},
91+
target: 'browserslist',
92+
optimization: { minimize: false },
93+
watch: true,
94+
module: {
95+
rules: [
96+
{
97+
test: /\.m?js$/,
98+
exclude: /node_modules/,
99+
use: ['babel-loader'],
100+
},
101+
],
105102
},
106-
plugins: [
107-
rollupConfig.resolve(),
108-
rollupConfig.commonjs(),
109-
rollupConfig.replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
110-
rollupConfig.babel({ exclude: 'node_modules/**' })
111-
]
112103
},
113104

114105
customPreprocessors: {
115-
rollupTests: {
116-
base: 'rollup',
106+
webpackTests: {
107+
base: 'webpack',
117108
options: {
118-
output: {
119-
name: 'html2pdf_test',
120-
format: 'iife',
121-
globals: {
122-
html2pdf: 'html2pdf',
123-
},
124-
},
109+
output: {},
110+
externals: ['html2pdf'],
111+
externalsType: 'global',
125112
},
126113
},
127114
},
128-
})
115+
});
129116
}

0 commit comments

Comments
 (0)