-
Notifications
You must be signed in to change notification settings - Fork 944
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converting packages to type: module by default (#2565)
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 f8184c3. * Found a few more spots to add a js extension to satisfy newer node16 module resolution.
- Loading branch information
1 parent
876702a
commit e0bdd0a
Showing
425 changed files
with
1,912 additions
and
1,214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.