Update Babel to 7.x
Update configuration to work with Babel 7 Explicitly require globals - eslint-plugin-mozilla needs it, but doesn't require it on its own. Fix Regexp to match Babel 7's inlined _interopRequireDefault
This commit is contained in:
parent
7b4f3035d2
commit
b46ec5195f
22
gulpfile.js
22
gulpfile.js
@ -176,12 +176,11 @@ function createWebpackConfig(defines, output) {
|
||||
// babel is too slow
|
||||
exclude: /src[\\\/]core[\\\/](glyphlist|unicode)/,
|
||||
options: {
|
||||
presets: skipBabel ? undefined : ['env'],
|
||||
presets: skipBabel ? undefined : ['@babel/preset-env'],
|
||||
plugins: [
|
||||
'transform-es2015-modules-commonjs',
|
||||
['transform-runtime', {
|
||||
'@babel/plugin-transform-modules-commonjs',
|
||||
['@babel/plugin-transform-runtime', {
|
||||
'helpers': false,
|
||||
'polyfill': false,
|
||||
'regenerator': true,
|
||||
}],
|
||||
],
|
||||
@ -903,25 +902,24 @@ gulp.task('lib', ['buildnumber'], function () {
|
||||
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
||||
content = babel.transform(content, {
|
||||
sourceType: 'module',
|
||||
presets: noPreset ? undefined : ['env'],
|
||||
presets: noPreset ? undefined : ['@babel/preset-env'],
|
||||
plugins: [
|
||||
'transform-es2015-modules-commonjs',
|
||||
['transform-runtime', {
|
||||
'@babel/plugin-transform-modules-commonjs',
|
||||
['@babel/plugin-transform-runtime', {
|
||||
'helpers': false,
|
||||
'polyfill': false,
|
||||
'regenerator': true,
|
||||
}],
|
||||
babelPluginReplaceNonWebPackRequire,
|
||||
],
|
||||
}).code;
|
||||
var removeCjsSrc =
|
||||
/^(var\s+\w+\s*=\s*require\('.*?)(?:\/src)(\/[^']*'\);)$/gm;
|
||||
content = content.replace(removeCjsSrc, function (all, prefix, suffix) {
|
||||
// eslint-disable-next-line max-len
|
||||
var removeCjsSrc = /^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
|
||||
content = content.replace(removeCjsSrc, (all, prefix, interop, suffix) => {
|
||||
return prefix + suffix;
|
||||
});
|
||||
return licenseHeaderLibre + content;
|
||||
}
|
||||
var babel = require('babel-core');
|
||||
var babel = require('@babel/core');
|
||||
var versionInfo = getVersionJSON();
|
||||
var ctx = {
|
||||
rootPath: __dirname,
|
||||
|
1865
package-lock.json
generated
1865
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -2,13 +2,14 @@
|
||||
"name": "pdf.js",
|
||||
"version": "2.0.0",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"acorn": "^5.7.3",
|
||||
"autoprefixer": "^8.6.5",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.5",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-loader": "^8.0.0",
|
||||
"core-js": "^2.5.7",
|
||||
"escodegen": "^1.11.0",
|
||||
"eslint": "^5.9.0",
|
||||
@ -16,6 +17,7 @@
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-unicorn": "^4.0.3",
|
||||
"fancy-log": "^1.3.2",
|
||||
"globals": "^9.18.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-postcss": "^7.0.1",
|
||||
"gulp-rename": "^1.4.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user