Skip to content

Commit

Permalink
Merge pull request #10293 from wojtekmaj/babel-7
Browse files Browse the repository at this point in the history
Upgrade to Babel 7
  • Loading branch information
timvandermeij authored Nov 23, 2018
2 parents 33fa33e + b46ec51 commit b9b8cef
Show file tree
Hide file tree
Showing 3 changed files with 1,375 additions and 1,023 deletions.
22 changes: 10 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}],
],
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit b9b8cef

Please sign in to comment.