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`.
This commit is contained in:
Tim van der Meij 2017-09-29 23:34:54 +02:00
parent 3717757b39
commit 0733b54e10
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
4 changed files with 30 additions and 29 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ Makefile
node_modules/ node_modules/
examples/node/svgdump/ examples/node/svgdump/
examples/node/pdf2png/*.png examples/node/pdf2png/*.png
package-lock.json

View File

@ -152,7 +152,7 @@ function createWebpackConfig(defines, output) {
loader: 'babel-loader', loader: 'babel-loader',
exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow
options: { options: {
presets: pdfjsNext ? undefined : ['es2015'], presets: pdfjsNext ? undefined : ['env'],
plugins: ['transform-es2015-modules-commonjs'], plugins: ['transform-es2015-modules-commonjs'],
}, },
}, },
@ -999,7 +999,7 @@ gulp.task('lib', ['buildnumber'], function () {
content = preprocessor2.preprocessPDFJSCode(ctx, content); content = preprocessor2.preprocessPDFJSCode(ctx, content);
content = babel.transform(content, { content = babel.transform(content, {
sourceType: 'module', sourceType: 'module',
presets: noPreset ? undefined : ['es2015'], presets: noPreset ? undefined : ['env'],
plugins: [ plugins: [
'transform-es2015-modules-commonjs', 'transform-es2015-modules-commonjs',
babelPluginReplaceNonWebPackRequire, babelPluginReplaceNonWebPackRequire,
@ -1043,7 +1043,7 @@ gulp.task('lib', ['buildnumber'], function () {
'!web/compatibility.js', '!web/compatibility.js',
], { base: '.', }), ], { base: '.', }),
gulp.src('test/unit/*.js', { base: '.', }), gulp.src('test/unit/*.js', { base: '.', }),
]).pipe(transform(preprocess)) ]).pipe(transform('utf8', preprocess))
.pipe(gulp.dest('build/lib/')); .pipe(gulp.dest('build/lib/'));
return merge([ return merge([
buildLib, buildLib,
@ -1316,7 +1316,7 @@ gulp.task('dist-pre',
license: DIST_LICENSE, license: DIST_LICENSE,
dependencies: { dependencies: {
'node-ensure': '^0.0.0', // shim for node for require.ensure '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: { browser: {
'fs': false, 'fs': false,

View File

@ -2,39 +2,39 @@
"name": "pdf.js", "name": "pdf.js",
"version": "1.0.0", "version": "1.0.0",
"devDependencies": { "devDependencies": {
"acorn": "^4.0.11", "acorn": "^5.1.2",
"babel-core": "^6.23.1", "babel-core": "^6.26.0",
"babel-loader": "^6.4.0", "babel-loader": "^7.1.2",
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-es2015": "^6.24.1", "babel-preset-env": "^1.6.0",
"core-js": "^2.5.0", "core-js": "^2.5.1",
"escodegen": "^1.8.0", "escodegen": "^1.9.0",
"eslint": "^4.5.0", "eslint": "^4.8.0",
"eslint-plugin-mozilla": "^0.4.3", "eslint-plugin-mozilla": "^0.4.4",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4", "gulp-replace": "^0.6.1",
"gulp-transform": "^1.1.0", "gulp-transform": "^3.0.5",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.8",
"gulp-zip": "^3.2.0", "gulp-zip": "^4.0.0",
"jasmine": "^2.5.2", "jasmine": "^2.8.0",
"jasmine-core": "^2.5.2", "jasmine-core": "^2.8.0",
"jsdoc": "^3.3.0-alpha9", "jsdoc": "^3.5.5",
"merge-stream": "^1.0.1", "merge-stream": "^1.0.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"node-ensure": "^0.0.0", "node-ensure": "^0.0.0",
"rimraf": "^2.4.1", "rimraf": "^2.6.2",
"streamqueue": "^1.1.1", "streamqueue": "^1.1.1",
"systemjs": "^0.20.7", "systemjs": "^0.20.19",
"systemjs-plugin-babel": "0.0.21", "systemjs-plugin-babel": "^0.0.25",
"ttest": "^1.1.0", "ttest": "^1.1.0",
"typogr": "^0.6.6", "typogr": "^0.6.7",
"uglify-es": "^3.0.28", "uglify-es": "^3.1.2",
"vinyl-fs": "^2.4.4", "vinyl-fs": "^2.4.4",
"webpack": "^3.5.5", "webpack": "^3.6.0",
"webpack-stream": "^4.0.0", "webpack-stream": "^4.0.0",
"wintersmith": "^2.0.0", "wintersmith": "^2.4.1",
"yargs": "^3.14.0" "yargs": "^9.0.1"
}, },
"scripts": { "scripts": {
"test": "gulp lint unittestcli externaltest" "test": "gulp lint unittestcli externaltest"

View File

@ -74,7 +74,7 @@
scriptLoad: false, scriptLoad: false,
esModule: true, esModule: true,
babelOptions: { babelOptions: {
es2015: false, env: false,
plugins: [babelPluginReplaceNonWebPackRequire], plugins: [babelPluginReplaceNonWebPackRequire],
}, },
}, },