Add Babel and core-js & regenerator polyfills (#367)
This commit is contained in:
parent
2b94300c61
commit
0ee37f557a
8 changed files with 1130 additions and 107 deletions
|
|
@ -3,3 +3,5 @@ layers/collection/extract.js
|
||||||
gulpfile.js
|
gulpfile.js
|
||||||
dist/brouter-web.js
|
dist/brouter-web.js
|
||||||
dist/turf.min.js
|
dist/turf.min.js
|
||||||
|
dist/core-js-bundle.min.js
|
||||||
|
dist/regenerator-runtime.js
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
{
|
{
|
||||||
"extends": ["plugin:compat/recommended"],
|
"extends": ["plugin:compat/recommended"],
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"polyfills": ["URLSearchParams", "Symbol.iterator", "Promise", "fetch", "Math", "Number", "navigator"]
|
"polyfills": ["URL", "Promise", "navigator", "Uint8Array", "performance", "location.hostname"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
README.md
14
README.md
|
|
@ -104,7 +104,7 @@ Copyright (c) 2018 Norbert Renner and [contributors](https://github.com/nrenner/
|
||||||
Copyright (c) 2017 i18next; [MIT License](https://github.com/i18next/i18next/blob/master/LICENSE)
|
Copyright (c) 2017 i18next; [MIT License](https://github.com/i18next/i18next/blob/master/LICENSE)
|
||||||
- [Leaflet TriangleMarker](https://github.com/themeler/leaflet-triangle-marker)
|
- [Leaflet TriangleMarker](https://github.com/themeler/leaflet-triangle-marker)
|
||||||
Copyright (c) 2018 Przemysław Melnarowicz; [MIT License](https://github.com/themeler/leaflet-triangle-marker/blob/master/LICENSE)
|
Copyright (c) 2018 Przemysław Melnarowicz; [MIT License](https://github.com/themeler/leaflet-triangle-marker/blob/master/LICENSE)
|
||||||
- [jsTree ](https://github.com/vakata/jstree)
|
- [jsTree](https://github.com/vakata/jstree)
|
||||||
Copyright (c) 2014 Ivan Bozhanov; [MIT License](https://github.com/vakata/jstree/blob/master/LICENSE-MIT)
|
Copyright (c) 2014 Ivan Bozhanov; [MIT License](https://github.com/vakata/jstree/blob/master/LICENSE-MIT)
|
||||||
- [Leaflet.snogylop](https://github.com/ebrelsford/leaflet.snogylop)
|
- [Leaflet.snogylop](https://github.com/ebrelsford/leaflet.snogylop)
|
||||||
Copyright (c) 2014 Eric Brelsford; [MIT License](https://github.com/ebrelsford/Leaflet.snogylop/blob/master/LICENSE)
|
Copyright (c) 2014 Eric Brelsford; [MIT License](https://github.com/ebrelsford/Leaflet.snogylop/blob/master/LICENSE)
|
||||||
|
|
@ -114,10 +114,6 @@ Copyright (c) 2018 Norbert Renner and [contributors](https://github.com/nrenner/
|
||||||
Copyright (c) 2016 Eduard <edward17>; [MIT License](https://github.com/Edward17/LayersCollection/blob/gh-pages/LICENSE.md)
|
Copyright (c) 2016 Eduard <edward17>; [MIT License](https://github.com/Edward17/LayersCollection/blob/gh-pages/LICENSE.md)
|
||||||
- [Leaflet-providers](https://github.com/leaflet-extras/leaflet-providers)
|
- [Leaflet-providers](https://github.com/leaflet-extras/leaflet-providers)
|
||||||
Copyright (c) 2013 Leaflet Providers contributors All rights reserved.; [2-clause BSD License](https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md)
|
Copyright (c) 2013 Leaflet Providers contributors All rights reserved.; [2-clause BSD License](https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md)
|
||||||
- [Fetch polyfill](https://github.com/Github/fetch)
|
|
||||||
Copyright (c) 2014-2016 GitHub, Inc.; [MIT License](https://github.com/github/fetch/blob/master/LICENSE)
|
|
||||||
- [Promise Polyfill](https://github.com/taylorhakes/promise-polyfill)
|
|
||||||
Copyright (c) 2014 Taylor Hakes, Copyright (c) 2014 Forbes Lindesay; [MIT License](https://github.com/taylorhakes/promise-polyfill/blob/master/LICENSE)
|
|
||||||
- [Leaflet.FileLayer](https://github.com/makinacorpus/Leaflet.FileLayer)
|
- [Leaflet.FileLayer](https://github.com/makinacorpus/Leaflet.FileLayer)
|
||||||
Copyright (c) 2012 Makina Corpus; [MIT License](https://github.com/makinacorpus/Leaflet.FileLayer/blob/master/LICENSE)
|
Copyright (c) 2012 Makina Corpus; [MIT License](https://github.com/makinacorpus/Leaflet.FileLayer/blob/master/LICENSE)
|
||||||
- [togeojson](https://github.com/mapbox/togeojson)
|
- [togeojson](https://github.com/mapbox/togeojson)
|
||||||
|
|
@ -127,4 +123,10 @@ Copyright (c) 2018 Norbert Renner and [contributors](https://github.com/nrenner/
|
||||||
- [leaflet-distance-markers](https://github.com/adoroszlai/leaflet-distance-markers)
|
- [leaflet-distance-markers](https://github.com/adoroszlai/leaflet-distance-markers)
|
||||||
Copyright (c) 2014- Doroszlai Attila, 2016- Phil Whitehurst; [MIT License](https://github.com/adoroszlai/leaflet-distance-markers/blob/master/LICENSE.md)
|
Copyright (c) 2014- Doroszlai Attila, 2016- Phil Whitehurst; [MIT License](https://github.com/adoroszlai/leaflet-distance-markers/blob/master/LICENSE.md)
|
||||||
- [Leaflet.hotline](https://github.com/iosphere/Leaflet.hotline)
|
- [Leaflet.hotline](https://github.com/iosphere/Leaflet.hotline)
|
||||||
Copyright (c) 2015, iosphere GmbH, Jonas Coch; [Leaflet.hotline](https://github.com/iosphere/Leaflet.hotline/blob/master/LICENSE)
|
Copyright (c) 2015, iosphere GmbH, Jonas Coch; [3-clause BSD License](https://github.com/iosphere/Leaflet.hotline/blob/master/LICENSE)
|
||||||
|
- [Babel](https://github.com/babel/babel)
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors; [MIT License](https://github.com/babel/babel/blob/main/LICENSE)
|
||||||
|
- [core-js](https://github.com/zloirock/core-js)
|
||||||
|
Copyright (c) 2014-2021 Denis Pushkarev; [MIT License](https://github.com/zloirock/core-js/blob/master/LICENSE)
|
||||||
|
- [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime)
|
||||||
|
Copyright (c) 2014-present, Facebook, Inc.; [MIT License](https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/LICENSE)
|
||||||
|
|
|
||||||
5
babel.config.json
Normal file
5
babel.config.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"presets": [["@babel/preset-env", {}]],
|
||||||
|
"sourceType": "script",
|
||||||
|
"exclude": ["node_modules/**"]
|
||||||
|
}
|
||||||
27
gulpfile.js
27
gulpfile.js
|
|
@ -27,6 +27,7 @@ var jsonConcat = require('gulp-json-concat');
|
||||||
var rename = require('gulp-rename');
|
var rename = require('gulp-rename');
|
||||||
var browserSync = require('browser-sync');
|
var browserSync = require('browser-sync');
|
||||||
var merge = require('merge-stream');
|
var merge = require('merge-stream');
|
||||||
|
var babel = require('gulp-babel');
|
||||||
|
|
||||||
const server = browserSync.create();
|
const server = browserSync.create();
|
||||||
|
|
||||||
|
|
@ -35,7 +36,12 @@ var debug = false;
|
||||||
var paths = {
|
var paths = {
|
||||||
// see overrides in package.json
|
// see overrides in package.json
|
||||||
scriptsConfig: mainNpmFiles()
|
scriptsConfig: mainNpmFiles()
|
||||||
.filter((f) => RegExp('url-search-params/.*\\.js', 'i').test(f))
|
.filter(
|
||||||
|
(f) =>
|
||||||
|
RegExp('url-search-params/.*\\.js', 'i').test(f) ||
|
||||||
|
RegExp('core-js-bundle/.*\\.js', 'i').test(f) ||
|
||||||
|
RegExp('regenerator-runtime/.*\\.js', 'i').test(f)
|
||||||
|
)
|
||||||
.concat([
|
.concat([
|
||||||
// large lib as extra file for faster parallel loading (*.min.js already excluded from bundle)
|
// large lib as extra file for faster parallel loading (*.min.js already excluded from bundle)
|
||||||
'node_modules/@turf/turf/turf.min.js',
|
'node_modules/@turf/turf/turf.min.js',
|
||||||
|
|
@ -50,7 +56,9 @@ var paths = {
|
||||||
(f) =>
|
(f) =>
|
||||||
RegExp('.*\\.js', 'i').test(f) &&
|
RegExp('.*\\.js', 'i').test(f) &&
|
||||||
!RegExp('.*\\.min\\.js', 'i').test(f) &&
|
!RegExp('.*\\.min\\.js', 'i').test(f) &&
|
||||||
!RegExp('url-search-params/.*\\.js', 'i').test(f)
|
!RegExp('url-search-params/.*\\.js', 'i').test(f) &&
|
||||||
|
!RegExp('core-js-bundle/.*\\.js', 'i').test(f) &&
|
||||||
|
!RegExp('regenerator-runtime/.*\\.js', 'i').test(f)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.concat([
|
.concat([
|
||||||
|
|
@ -92,7 +100,19 @@ gulp.task('clean', function (cb) {
|
||||||
// libs that require loading before config.js
|
// libs that require loading before config.js
|
||||||
gulp.task('scripts_config', function () {
|
gulp.task('scripts_config', function () {
|
||||||
// just copy for now
|
// just copy for now
|
||||||
return gulp.src(paths.scriptsConfig).pipe(gulp.dest(paths.dest));
|
return gulp
|
||||||
|
.src(paths.scriptsConfig)
|
||||||
|
.pipe(
|
||||||
|
rename(function (path) {
|
||||||
|
if (path.basename === 'minified') {
|
||||||
|
path.basename = 'core-js-bundle.min';
|
||||||
|
} else if (path.basename === 'runtime') {
|
||||||
|
path.basename = 'regenerator-runtime';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.pipe(replace('//# sourceMappingURL=minified.js.map', ''))
|
||||||
|
.pipe(gulp.dest(paths.dest));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('scripts', function () {
|
gulp.task('scripts', function () {
|
||||||
|
|
@ -103,6 +123,7 @@ gulp.task('scripts', function () {
|
||||||
.src(paths.scripts, { base: '.' })
|
.src(paths.scripts, { base: '.' })
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
.pipe(cached('scripts'))
|
.pipe(cached('scripts'))
|
||||||
|
.pipe(gulpif(!debug, babel()))
|
||||||
.pipe(gulpif(!debug, uglify()))
|
.pipe(gulpif(!debug, uglify()))
|
||||||
.pipe(remember('scripts'))
|
.pipe(remember('scripts'))
|
||||||
.pipe(concat(paths.destName + '.js'))
|
.pipe(concat(paths.destName + '.js'))
|
||||||
|
|
|
||||||
|
|
@ -1106,6 +1106,8 @@
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script src="dist/core-js-bundle.min.js"></script>
|
||||||
|
<script src="dist/regenerator-runtime.js"></script>
|
||||||
<!-- <script src="dist/url-search-params.js"></script> -->
|
<!-- <script src="dist/url-search-params.js"></script> -->
|
||||||
<script src="config.js"></script>
|
<script src="config.js"></script>
|
||||||
<script src="keys.js"></script>
|
<script src="keys.js"></script>
|
||||||
|
|
|
||||||
22
package.json
22
package.json
|
|
@ -46,6 +46,7 @@
|
||||||
"bootstrap-select": "1.13.6",
|
"bootstrap-select": "1.13.6",
|
||||||
"bootstrap-slider": "^9.8.1",
|
"bootstrap-slider": "^9.8.1",
|
||||||
"codemirror": "^5.35.0",
|
"codemirror": "^5.35.0",
|
||||||
|
"core-js-bundle": "^3.8.3",
|
||||||
"datatables": "~1.10.18",
|
"datatables": "~1.10.18",
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"geo-data-exchange": "alexcojocaru/geo-data-exchange#v1.1.0",
|
"geo-data-exchange": "alexcojocaru/geo-data-exchange#v1.1.0",
|
||||||
|
|
@ -73,19 +74,22 @@
|
||||||
"leaflet.stravasegments": "2.3.2",
|
"leaflet.stravasegments": "2.3.2",
|
||||||
"mapbbcode": "MapBBCode/mapbbcode#v1.2.0",
|
"mapbbcode": "MapBBCode/mapbbcode#v1.2.0",
|
||||||
"osmtogeojson": "^3.0.0-beta.4",
|
"osmtogeojson": "^3.0.0-beta.4",
|
||||||
"promise-polyfill": "^8.2.0",
|
"regenerator-runtime": "^0.13.7",
|
||||||
"togpx": "^0.5.4",
|
"togpx": "^0.5.4",
|
||||||
"topojson-client": "^3.1.0",
|
"topojson-client": "^3.1.0",
|
||||||
"url-search-params": "~0.5.0",
|
"url-search-params": "~0.5.0"
|
||||||
"whatwg-fetch": "^3.5.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^7.12.13",
|
||||||
|
"@babel/core": "^7.12.13",
|
||||||
|
"@babel/preset-env": "^7.12.13",
|
||||||
"autoprefixer": "^8.1.0",
|
"autoprefixer": "^8.1.0",
|
||||||
"browser-sync": "^2.26.14",
|
"browser-sync": "^2.26.14",
|
||||||
"del": "^1.1.1",
|
"del": "^1.1.1",
|
||||||
"eslint": "^7.15.0",
|
"eslint": "^7.15.0",
|
||||||
"eslint-plugin-compat": "^3.3.0",
|
"eslint-plugin-compat": "^3.9.0",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-bump": "^3.2.0",
|
"gulp-bump": "^3.2.0",
|
||||||
"gulp-cached": "^1.0.4",
|
"gulp-cached": "^1.0.4",
|
||||||
"gulp-clean-css": "^4.3.0",
|
"gulp-clean-css": "^4.3.0",
|
||||||
|
|
@ -247,11 +251,6 @@
|
||||||
"dist/themes/default/*.png"
|
"dist/themes/default/*.png"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"promise-polyfill": {
|
|
||||||
"main": [
|
|
||||||
"dist/polyfill.js"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Leaflet.vector-markers": {
|
"Leaflet.vector-markers": {
|
||||||
"main": [
|
"main": [
|
||||||
"dist/leaflet-vector-markers.js",
|
"dist/leaflet-vector-markers.js",
|
||||||
|
|
@ -272,6 +271,11 @@
|
||||||
"main": [
|
"main": [
|
||||||
"togpx.js"
|
"togpx.js"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"core-js-bundle": {
|
||||||
|
"main": [
|
||||||
|
"minified.js"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue