From 0733b54e107ef92c0b5856343f0b6c411669efa8 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Fri, 29 Sep 2017 23:34:54 +0200 Subject: [PATCH] Update all packages to the most recent version To support this, the following changes have to be made as well: - Ignore `package-lock.json` since NPM creates it, but we should not have it in the repository. - Switch from `babel-preset-es2015` to `babel-preset-env` to resolve the deprecation warning in the test logs. The latter is more recent and flexible, but should be the same functionality-wise. - `transform` now needs to have the `utf-8` encoding option provided. If not given, it will call the callback with a `Buffer` object, which results in an unhandled promise rejection since what is returned from the callback is a string, not a `Buffer`. --- .gitignore | 1 + gulpfile.js | 8 ++++---- package.json | 48 +++++++++++++++++++++++----------------------- systemjs.config.js | 2 +- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 157225dcd..4441a9a84 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ Makefile node_modules/ examples/node/svgdump/ examples/node/pdf2png/*.png +package-lock.json diff --git a/gulpfile.js b/gulpfile.js index c3a46c514..daa7d9efd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -152,7 +152,7 @@ function createWebpackConfig(defines, output) { loader: 'babel-loader', exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow options: { - presets: pdfjsNext ? undefined : ['es2015'], + presets: pdfjsNext ? undefined : ['env'], plugins: ['transform-es2015-modules-commonjs'], }, }, @@ -999,7 +999,7 @@ gulp.task('lib', ['buildnumber'], function () { content = preprocessor2.preprocessPDFJSCode(ctx, content); content = babel.transform(content, { sourceType: 'module', - presets: noPreset ? undefined : ['es2015'], + presets: noPreset ? undefined : ['env'], plugins: [ 'transform-es2015-modules-commonjs', babelPluginReplaceNonWebPackRequire, @@ -1043,7 +1043,7 @@ gulp.task('lib', ['buildnumber'], function () { '!web/compatibility.js', ], { base: '.', }), gulp.src('test/unit/*.js', { base: '.', }), - ]).pipe(transform(preprocess)) + ]).pipe(transform('utf8', preprocess)) .pipe(gulp.dest('build/lib/')); return merge([ buildLib, @@ -1316,7 +1316,7 @@ gulp.task('dist-pre', license: DIST_LICENSE, dependencies: { 'node-ensure': '^0.0.0', // shim for node for require.ensure - 'worker-loader': '^0.8.0', // used in external/dist/webpack.json + 'worker-loader': '^1.0.0', // used in external/dist/webpack.json }, browser: { 'fs': false, diff --git a/package.json b/package.json index 9f62779c1..77cddaa56 100644 --- a/package.json +++ b/package.json @@ -2,39 +2,39 @@ "name": "pdf.js", "version": "1.0.0", "devDependencies": { - "acorn": "^4.0.11", - "babel-core": "^6.23.1", - "babel-loader": "^6.4.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", - "babel-preset-es2015": "^6.24.1", - "core-js": "^2.5.0", - "escodegen": "^1.8.0", - "eslint": "^4.5.0", - "eslint-plugin-mozilla": "^0.4.3", + "acorn": "^5.1.2", + "babel-core": "^6.26.0", + "babel-loader": "^7.1.2", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", + "babel-preset-env": "^1.6.0", + "core-js": "^2.5.1", + "escodegen": "^1.9.0", + "eslint": "^4.8.0", + "eslint-plugin-mozilla": "^0.4.4", "gulp": "^3.9.1", "gulp-rename": "^1.2.2", - "gulp-replace": "^0.5.4", - "gulp-transform": "^1.1.0", - "gulp-util": "^3.0.7", - "gulp-zip": "^3.2.0", - "jasmine": "^2.5.2", - "jasmine-core": "^2.5.2", - "jsdoc": "^3.3.0-alpha9", + "gulp-replace": "^0.6.1", + "gulp-transform": "^3.0.5", + "gulp-util": "^3.0.8", + "gulp-zip": "^4.0.0", + "jasmine": "^2.8.0", + "jasmine-core": "^2.8.0", + "jsdoc": "^3.5.5", "merge-stream": "^1.0.1", "mkdirp": "^0.5.1", "node-ensure": "^0.0.0", - "rimraf": "^2.4.1", + "rimraf": "^2.6.2", "streamqueue": "^1.1.1", - "systemjs": "^0.20.7", - "systemjs-plugin-babel": "0.0.21", + "systemjs": "^0.20.19", + "systemjs-plugin-babel": "^0.0.25", "ttest": "^1.1.0", - "typogr": "^0.6.6", - "uglify-es": "^3.0.28", + "typogr": "^0.6.7", + "uglify-es": "^3.1.2", "vinyl-fs": "^2.4.4", - "webpack": "^3.5.5", + "webpack": "^3.6.0", "webpack-stream": "^4.0.0", - "wintersmith": "^2.0.0", - "yargs": "^3.14.0" + "wintersmith": "^2.4.1", + "yargs": "^9.0.1" }, "scripts": { "test": "gulp lint unittestcli externaltest" diff --git a/systemjs.config.js b/systemjs.config.js index 7a4d8df8b..378d6f37f 100644 --- a/systemjs.config.js +++ b/systemjs.config.js @@ -74,7 +74,7 @@ scriptLoad: false, esModule: true, babelOptions: { - es2015: false, + env: false, plugins: [babelPluginReplaceNonWebPackRequire], }, },