Skip to content

Commit

Permalink
Tarea: #274793 Fichero mutated de Mapea y se elimina Babel.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Manuel Rebollar Marquez committed Jun 22, 2023
1 parent b9cd33f commit f2d570b
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 138 deletions.
4 changes: 0 additions & 4 deletions mapea-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
"url": "https://github.com/sigcorporativo-ja/Mapea4/issues"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-export-default-from": "^7.0.0-beta.51",
"@babel/preset-env": "^7.4.4",
"babel-loader": "^8.0.0-beta.4",
"chromedriver": "^2.46.0",
"copy-webpack-plugin": "^6.1.0",
"cross-env": "^5.2.0",
Expand Down
172 changes: 86 additions & 86 deletions mapea-js/webpack-config/mutate-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,41 @@
const CONF_ENV = {
dev: [{
path: 'ol/format/GML3',
original: `GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
}
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]);
if (opt_hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
return coords;
};`,
mutated: `GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
original: `getCoords_(point, srsName, hasZ) {
let axisOrientation = 'enu';
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
let coords =
axisOrientation.substr(0, 2) === 'en'
? point[0] + ' ' + point[1]
: point[1] + ' ' + point[0];
if (hasZ) {
// For newly created points, Z can be undefined.
const z = point[2] || 0;
coords += ' ' + z;
}
return coords;
}`,
mutated: `getCoords_(point, opt_srsName, opt_hasZ) {
return point[0] + ' ' + point[1];
};`,
}, {
path: 'ol/layer/Layer',
original: `export function inView(layerState, viewState) {
if (!layerState.visible) {
return false;
}
var resolution = viewState.resolution;
if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {
return false;
}
var zoom = viewState.zoom;
return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
if (!layerState.visible) {
return false;
}
const resolution = viewState.resolution;
if (
resolution < layerState.minResolution ||
resolution >= layerState.maxResolution
) {
return false;
}
const zoom = viewState.zoom;
return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
}`,
mutated: `export function inView(layerState, viewState) {
if (!layerState.visible) {
Expand All @@ -55,33 +60,32 @@ const CONF_ENV = {
},
{
path: 'ol/format/GML3',
original: `GML3.prototype.writePos_ = function (node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsDimension = hasZ ? '3' : '2';
node.setAttribute('srsDimension', srsDimension);
var srsName = context['srsName'];
var axisOrientation = 'enu';
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
var point = value.getCoordinates();
var coords;
// only 2d for simple features profile
if (axisOrientation.substr(0, 2) === 'en') {
coords = (point[0] + ' ' + point[1]);
}
else {
coords = (point[1] + ' ' + point[0]);
}
if (hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
writeStringTextNode(node, coords);
};`,
mutated: `GML3.prototype.writePos_ = function (node, value, objectStack) {
original: `writePos_(node, value, objectStack) {
const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ'];
const srsDimension = hasZ ? '3' : '2';
node.setAttribute('srsDimension', srsDimension);
const srsName = context['srsName'];
let axisOrientation = 'enu';
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
const point = value.getCoordinates();
let coords;
// only 2d for simple features profile
if (axisOrientation.substr(0, 2) === 'en') {
coords = point[0] + ' ' + point[1];
} else {
coords = point[1] + ' ' + point[0];
}
if (hasZ) {
// For newly created points, Z can be undefined.
const z = point[2] || 0;
coords += ' ' + z;
}
writeStringTextNode(node, coords);
}`,
mutated: `writePos_(node, value, objectStack) {
var point = value.getCoordinates();
var coords = point[0] + " " + point[1];
writeStringTextNode(node, coords);
Expand All @@ -90,24 +94,24 @@ const CONF_ENV = {
],
prod: [{
path: 'ol/format/GML3',
original: `GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
original: `getCoords_(point, srsName, hasZ) {
let axisOrientation = 'enu';
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
var coords = axisOrientation.substr(0, 2) === 'en' ? point[0] + ' ' + point[1] : point[1] + ' ' + point[0];
if (opt_hasZ) {
let coords =
axisOrientation.substr(0, 2) === 'en'
? point[0] + ' ' + point[1]
: point[1] + ' ' + point[0];
if (hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
const z = point[2] || 0;
coords += ' ' + z;
}
return coords;
};`,
mutated: `GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
}`,
mutated: `getCoords_(point, opt_srsName, opt_hasZ) {
return point[0] + ' ' + point[1];
};`,
}, {
Expand All @@ -116,14 +120,14 @@ const CONF_ENV = {
if (!layerState.visible) {
return false;
}
var resolution = viewState.resolution;
if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {
const resolution = viewState.resolution;
if (
resolution < layerState.minResolution ||
resolution >= layerState.maxResolution
) {
return false;
}
var zoom = viewState.zoom;
const zoom = viewState.zoom;
return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
}`,
mutated: `export function inView(layerState, viewState) {
Expand All @@ -140,36 +144,32 @@ const CONF_ENV = {
},
{
path: 'ol/format/GML3',
original: `GML3.prototype.writePos_ = function (node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsDimension = hasZ ? '3' : '2';
original: `writePos_(node, value, objectStack) {
const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ'];
const srsDimension = hasZ ? '3' : '2';
node.setAttribute('srsDimension', srsDimension);
var srsName = context['srsName'];
var axisOrientation = 'enu';
const srsName = context['srsName'];
let axisOrientation = 'enu';
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
var point = value.getCoordinates();
var coords; // only 2d for simple features profile
const point = value.getCoordinates();
let coords;
// only 2d for simple features profile
if (axisOrientation.substr(0, 2) === 'en') {
coords = point[0] + ' ' + point[1];
} else {
coords = point[1] + ' ' + point[0];
}
if (hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
const z = point[2] || 0;
coords += ' ' + z;
}
writeStringTextNode(node, coords);
};`,
mutated: `GML3.prototype.writePos_ = function (node, value, objectStack) {
}`,
mutated: `writePos_(node, value, objectStack) {
var point = value.getCoordinates();
var coords = point[0] + " " + point[1];
writeStringTextNode(node, coords);
Expand Down
17 changes: 1 addition & 16 deletions mapea-js/webpack-config/webpack.development.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,7 @@ module.exports = {
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
],
},
},
exclude: /(node_modules|bower_components)/
},
{
test: /\.js$/,
Expand Down
17 changes: 1 addition & 16 deletions mapea-js/webpack-config/webpack.production-core.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,7 @@ module.exports = {
include: /node_modules\/ol\/*/,
}, {
test: /\.js$/,
exclude: /(node_modules\/(?!ol)|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
],
},
},
exclude: /(node_modules\/(?!ol)|bower_components)/
},
{
test: /\.js$/,
Expand Down
17 changes: 1 addition & 16 deletions mapea-js/webpack-config/webpack.production-plugins.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,7 @@ module.exports = {
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules\/(?!ol)|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
],
},
},
exclude: /(node_modules\/(?!ol)|bower_components)/
},
{
test: /\.js$/,
Expand Down

0 comments on commit f2d570b

Please sign in to comment.