Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel 7 upgrade #1371

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"license": "(LGPL-2.1 OR Artistic-2.0)",
"dependencies": {
"@babel/runtime": "^7.4.5",
"express": "^4.15.4",
"fs-extra": "^4.0.1",
"node-fetch": "^2.2.0",
Expand All @@ -40,23 +41,22 @@
"shelljs": "^0.7.8"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@gmod/bam": "^1.0.15",
"@gmod/cram": "^1.5.1",
"@gmod/cram": "^1.5.3",
"@gmod/gff": "^1.1.1",
"@gmod/indexedfasta": "^1.0.11",
"@gmod/tabix": "^1.1.5",
"@gmod/tribble-index": "^2.0.3",
"@gmod/twobit": "^1.1.2",
"@gmod/tribble-index": "^2.0.4",
"@gmod/twobit": "^1.1.9",
"@gmod/vcf": "^2.0.2",
"ajv": "^6.2.1",
"ava": "^0.25.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^7.1.4",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015-without-strict": "^0.0.4",
"babel-loader": "^8.0.6",
"buffer-crc32": "^0.2.13",
"clean-webpack-plugin": "^0.1.18",
"copy-webpack-plugin": "^4.6.0",
Expand All @@ -66,7 +66,7 @@
"dojo": "^1.14.2",
"dojo-dstore": "^1.1.1",
"dojo-util": "^1.14.2",
"dojo-webpack-plugin": "^2.8.5",
"dojo-webpack-plugin": "^2.8.8",
"dojox": "^1.14.2",
"electron": "^3.0.12",
"electron-packager": "^12.0.1",
Expand All @@ -89,11 +89,11 @@
"style-loader": "^0.20.2",
"tenacious-fetch": "^2.1.0",
"tmp": "^0.0.33",
"uglifyjs-webpack-plugin": "^1.2.2",
"uglifyjs-webpack-plugin": "^2.1.3",
"url-loader": "0.5.7",
"util-deprecate": "^1.0.2",
"webpack": "^4.26.1",
"webpack-cli": "^3.1.2",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
"whatwg-fetch": "^2.0.4",
"yarn": "^1.12.3"
}
Expand Down
9 changes: 6 additions & 3 deletions src/JBrowse/Store/SeqFeature/IndexedStatsEstimationMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ return declare( GlobalStats, {
* estimate the feature density of the store.
* @private
*/
async _estimateGlobalStats(refseq) {
refseq = refseq || this.refSeq
_estimateGlobalStats: async function _estimateGlobalStats(query) {
const refseq = query || this.refSeq || {}
let featCount
if(!refseq.name || !refseq.name.length) {
featCount = -1
}
if (this.indexedData) {
featCount = await this.indexedData.lineCount(this.browser.regularizeReferenceName(refseq.name))
} else if (this.bam) {
Expand All @@ -25,7 +28,7 @@ return declare( GlobalStats, {
featCount = await this.bam.index.lineCount(chrId, true)
}
if (featCount == -1) {
return this.inherited('_estimateGlobalStats', arguments)
return this.inherited(_estimateGlobalStats, arguments)
}
const correctionFactor = (this.getConf('topLevelFeaturesPercent') || 100) / 100
const featureDensity = featCount / (refseq.end - refseq.start) * correctionFactor
Expand Down
4 changes: 2 additions & 2 deletions src/JBrowse/View/Export/GFF3.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ return declare( ExportBase,
return this._gff3_reserved_attributes_by_lcname[ fieldname.toLowerCase() ];
},

exportRegion(region, callback) {
exportRegion: function exportRegion(region, callback) {
this.print( "##gff-version 3\n");
this.print( `##sequence-region ${region.ref} ${region.start+1} ${region.end}\n` );
this.inherited(arguments)
this.inherited(exportRegion, arguments)
},

/**
Expand Down
3 changes: 2 additions & 1 deletion src/JBrowse/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'babel-polyfill'
import "@babel/polyfill";


require([
'JBrowse/Browser',
Expand Down
2 changes: 1 addition & 1 deletion src/JBrowse/standalone.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-polyfill'
import '@babel/polyfill'

require([
'JBrowse/Browser',
Expand Down
2 changes: 1 addition & 1 deletion tests/js_tests/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__webpack_public_path__ = '../../dist/'

import 'babel-polyfill'
import '@babel/polyfill'

var jasmine = window.jasmine;
var jasmineEnv = jasmine.getEnv();
Expand Down
20 changes: 12 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env node */
require('babel-polyfill')
require('@babel/polyfill')

const DojoWebpackPlugin = require("dojo-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")
Expand All @@ -10,6 +10,8 @@ const path = require("path")
const glob = require('glob')
const webpack = require("webpack")



// if JBROWSE_BUILD_MIN env var is 1 or true, then we also minimize the JS
// and forego generating source maps
const DEBUG = ! [1,'1','true'].includes(process.env.JBROWSE_BUILD_MIN)
Expand Down Expand Up @@ -56,17 +58,18 @@ var webpackConf = {
),
],
module: {
// the order of these rules does matter
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!(quick-lru|@gmod\/cram|@gmod\/bam|@gmod\/indexedfasta|@gmod\/tabix|@gmod\/tribble-index|@gmod\/binary-parser|@gmod\/bgzf-filehandle))/,
exclude: /node_modules\/(?!quick-lru)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015-without-strict'],
plugins: ['transform-async-to-generator','transform-es2015-classes'],
cacheDirectory: true
}
loader: 'babel-loader',
options: {
sourceType: 'unambiguous', // this bypasses some things with using module.exports and export es6
presets: ['@babel/preset-env'],
//plugins: ['@babel/plugin-transform-runtime']
}
}
},
{
Expand Down Expand Up @@ -111,6 +114,7 @@ if (DEBUG) {
webpackConf.mode = 'development'
webpackConf.entry.run_jasmine = 'tests/js_tests/main.js'
webpackConf.plugins.push( new webpack.optimize.AggressiveMergingPlugin() )

} else {
webpackConf.mode = 'production'
webpackConf.plugins.push( new UglifyJsPlugin())
Expand Down
Loading