Skip to content

Commit

Permalink
Merge pull request #9215 from camptocamp/set-browser-list
Browse files Browse the repository at this point in the history
Use the @babel/preset-env to select working list of browser
  • Loading branch information
sbrunner authored Sep 15, 2023
2 parents 35c3b1b + f97846f commit 5bbf3cf
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 23 deletions.
2 changes: 1 addition & 1 deletion buildtools/check-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function loaded(page, browser) {
process.exit(2);
}
);
}, 500);
}, 1000);
} else {
await browser.close();
}
Expand Down
10 changes: 7 additions & 3 deletions buildtools/webpack.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ module.exports = (env, argv) => {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
presets: [
[
'@babel/preset-env',
{
targets: require('./webpack.share').browsers,
},
],
],
},
},
Expand Down
25 changes: 13 additions & 12 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ module.exports = function (config) {
$: 'jquery',
});

const babelPresetEnv = [
require.resolve('@babel/preset-env'),
{
targets: config.browsers || require('./webpack.share').browsers,
debug: true,
loose: true,
},
];

// Expose corejs-typeahead as window.Bloodhound
const typeaheadRule = {
test: require.resolve('corejs-typeahead'),
Expand Down Expand Up @@ -144,16 +153,14 @@ module.exports = function (config) {
assumptions: {
setPublicClassFields: true,
},
presets: [babelPresetEnv],
plugins: [
[
require.resolve('@babel/plugin-transform-typescript'),
// TODO remove allowDeclareFields with Babel 8
{allowDeclareFields: true},
],
[require.resolve('@babel/plugin-proposal-decorators'), {decoratorsBeforeExport: true}],
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
},
},
Expand All @@ -173,11 +180,8 @@ module.exports = function (config) {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('babel-plugin-angularjs-annotate'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
presets: [babelPresetEnv],
plugins: [require.resolve('babel-plugin-angularjs-annotate')],
},
},
};
Expand All @@ -200,10 +204,7 @@ module.exports = function (config) {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
presets: [babelPresetEnv],
},
},
};
Expand Down
10 changes: 7 additions & 3 deletions buildtools/webpack.config.dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ module.exports = {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: require('./webpack.share').browsers,
},
],
],
},
},
Expand Down
25 changes: 25 additions & 0 deletions buildtools/webpack.share.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// The MIT License (MIT)
//
// Copyright (c) 2018-2023 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

module.exports = {
// see: npx browserslist '> 0.7% in CH or > 0.7% in FR or Firefox ESR'
browsers: 'defaults, > 0.1% in CH, > 0.1% in FR, Firefox ESR and supports es6-class and not iOS < 10',
};
Binary file modified contribs/gmf/examples/displayquerygrid-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/displayquerywindow-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/layertree-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/layertreeadd-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/print-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/layerorder-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/mapfishprint-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2017-2021 Camptocamp SA
// Copyright (c) 2017-2023 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -32,9 +32,6 @@ module.exports = (env, args) => {
case 'dist':
common_config.nodll = true;
break;
case 'ngeo-examples':
case 'gmf-examples':
common_config.browsers = ['> 0.5% in CH', '> 0.5% in FR', 'Firefox ESR', 'ie 11'];
}
let config = require('./buildtools/webpack.commons')(common_config);

Expand Down

0 comments on commit 5bbf3cf

Please sign in to comment.