Updating Turf packags to be ESM modules rather than a CommonJS project. The build still generates and packages both ESM and CJS variants of implementation and types. From a client perspective, nothing should change about the way Turf modules are loaded or called.
* Marking all packages as "ESM first", with additional CJS files for compatibility. Flow on changes from that include requiring a js extension for relative includes, and workarounds for a couple of older third party libraries that were no longer importing smoothly. Builds successfully. Updating tests next.
* Adding js extension to more local imports in tests, and removing references to __dirname. Added some re-exporting wrapper files for older packages like rbush and sweepline-intersections. See turf-line-intersects for an example.
* Disabling some type tests in packages we were having export / import issues in post type: module. Maybe someone in future can exercise some typescript jujitsu to re-enable them.
* Reverting dist/ generated JS to .js extension where possible. Was identified that the .cjs extension was causing problems for some consumers. Would have like to use .d.ts rather .d.cts for CJS type defs, but there's a but in tsup at the moment that won't allow that to be customised.
* Reintroducing __dirname references, though need to add implementation as not supplied automatically by node any more. Updating benchmark tests. Adding some missing bench and tape @types libraries.
* Added a few __dirname references that should have been included, and removed a few that had inadvertently been added.
* Explicitly using cjs extension for CommonJS distributed source files. Got disabled types tests working again by adjusting tsc command (needed to include node16 module and moduleResolution switched on command line). Also needed to refer to "index", etc as "index.js", etc from test.ts files to avoid "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16'" errors.
* Missed a .js -> .cjs in turf/turf last-checks target.
* Removing hacky cjs/esm export/import wrappers in favour of defaultImport library which takes care of finding the correct default to import from CJS packages.
* Revert "Removing hacky cjs/esm export/import wrappers in favour of defaultImport library which takes care of finding the correct default to import from CJS packages."
This reverts commit f8184c3fb124369b36fb9afa4e1aa83543417e42.
* Found a few more spots to add a js extension to satisfy newer node16 module resolution.
* Converting bench.js and test.js to Typescript. Adding along as a named export as well as the default.
* Converting bench.js and test.js to Typescript and ESM import. Adding angle as a named export as well as the default.
* Converting bench.js and test.js to Typescript and ESM import. Adding area as a named export as well as the default.
* Making turf last-checks a bit more flexible as we will have a mix of JS and TS test files for a while.
* Converting bench.js and test.js to Typescript and ESM import, and adding named exports as well as the default export for modules:
bbox
bboxCliip
bboxPolygon
bearing
bezierSpline
booleanClockwise
booleanConcave
booleanContains
booleanCrosses
booleanDisjoint
booleanEqual
booleanIntersect
booleanOverlap
booleanParallel
booleanPointInPolygon
booleanPointOnLine
booleanTouches
booleanValid
booleanWithin
* Converting bench.js and test.js to Typescript and ESM import for remaining Typescript modules. Also adding named exports in addition to the default export for those same modules.
* Proceeding with migrating remaining tests to Typescript. Still a few to do - waiting for PR #2543 to merge first to avoid conflicts.
* Converting bench.js and test.js to Typescript and ESM import for some more Typescript modules (postponed until recent PRs merged). Also adding named exports in addition to the default export for those same modules.
* Banishing a couple more require() calls from module code.
* Retiring custom rollup typescript plugin. Problem it was designed to address probably fixed by a previous typescript upgrade. Removing redundant es5 checking script that hasn't been used for a while as well.