Skip to content

Bump turf from v6.5 to v7 #7116

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

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions draftlogs/7116_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Update turf to v7 [[#7116](https://github.com/plotly/plotly.js/pull/7116)]

72 changes: 47 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
"@plotly/d3-sankey": "0.7.2",
"@plotly/d3-sankey-circular": "0.33.1",
"@plotly/mapbox-gl": "1.13.4",
"@turf/area": "^6.5.0",
"@turf/bbox": "^6.5.0",
"@turf/centroid": "^6.5.0",
"@turf/area": "^7.1.0",
"@turf/bbox": "^7.1.0",
"@turf/centroid": "^7.1.0",
"base64-arraybuffer": "^1.0.2",
"canvas-fit": "^1.5.0",
"color-alpha": "1.0.4",
Expand Down
12 changes: 6 additions & 6 deletions src/lib/geo_location_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var d3 = require('@plotly/d3');
var countryRegex = require('country-regex');
var turfArea = require('@turf/area');
var turfCentroid = require('@turf/centroid');
var turfBbox = require('@turf/bbox');
var { area: turfArea } = require('@turf/area');
var { centroid: turfCentroid } = require('@turf/centroid');
var { bbox: turfBbox } = require('@turf/bbox');

var identity = require('./identity');
var loggers = require('./loggers');
Expand Down Expand Up @@ -295,7 +295,7 @@ function findCentroid(feature) {

for(var i = 0; i < coords.length; i++) {
var polyi = {type: 'Polygon', coordinates: coords[i]};
var area = turfArea.default(polyi);
var area = turfArea(polyi);
if(area > maxArea) {
maxArea = area;
poly = polyi;
Expand All @@ -305,7 +305,7 @@ function findCentroid(feature) {
poly = geometry;
}

return turfCentroid.default(poly).geometry.coordinates;
return turfCentroid(poly).geometry.coordinates;
}

function fetchTraceGeoData(calcData) {
Expand Down Expand Up @@ -366,7 +366,7 @@ function fetchTraceGeoData(calcData) {
// TODO `turf/bbox` gives wrong result when the input feature/geometry
// crosses the anti-meridian. We should try to implement our own bbox logic.
function computeBbox(d) {
return turfBbox.default(d);
return turfBbox(d);
}

module.exports = {
Expand Down