From fc9a7db44304a263e26d957dfa535d6e0979b1b0 Mon Sep 17 00:00:00 2001 From: James Diacono Date: Tue, 17 Nov 2020 14:01:09 +1100 Subject: [PATCH] Node ESM support Writes a package.json to each dist/es/ directory, which ensures that Node loads adjacent files as ES modules. close #1940 --- .monorepolint.config.ts | 25 ++++++++++++++++--- packages/turf-along/package.json | 6 ++++- packages/turf-angle/package.json | 6 ++++- packages/turf-area/package.json | 6 ++++- packages/turf-bbox-clip/package.json | 6 ++++- packages/turf-bbox-polygon/package.json | 6 ++++- packages/turf-bbox/package.json | 6 ++++- packages/turf-bearing/package.json | 6 ++++- packages/turf-bezier-spline/package.json | 6 ++++- packages/turf-boolean-clockwise/package.json | 6 ++++- packages/turf-boolean-concave/package.json | 6 ++++- packages/turf-boolean-contains/package.json | 6 ++++- packages/turf-boolean-crosses/package.json | 6 ++++- packages/turf-boolean-disjoint/package.json | 6 ++++- packages/turf-boolean-equal/package.json | 6 ++++- packages/turf-boolean-intersects/package.json | 6 ++++- packages/turf-boolean-overlap/package.json | 6 ++++- packages/turf-boolean-parallel/package.json | 6 ++++- .../package.json | 6 ++++- .../turf-boolean-point-on-line/package.json | 6 ++++- packages/turf-boolean-touches/package.json | 6 ++++- packages/turf-boolean-valid/package.json | 6 ++++- packages/turf-boolean-within/package.json | 6 ++++- packages/turf-buffer/package.json | 6 ++++- packages/turf-center-mean/package.json | 6 ++++- packages/turf-center-median/package.json | 6 ++++- packages/turf-center-of-mass/package.json | 6 ++++- packages/turf-center/package.json | 6 ++++- packages/turf-centroid/package.json | 6 ++++- packages/turf-circle/package.json | 6 ++++- packages/turf-clean-coords/package.json | 6 ++++- packages/turf-clone/package.json | 6 ++++- packages/turf-clusters-dbscan/package.json | 6 ++++- packages/turf-clusters-kmeans/package.json | 6 ++++- packages/turf-clusters/package.json | 6 ++++- packages/turf-collect/package.json | 6 ++++- packages/turf-combine/package.json | 6 ++++- packages/turf-concave/package.json | 6 ++++- packages/turf-convex/package.json | 6 ++++- packages/turf-destination/package.json | 6 ++++- packages/turf-difference/package.json | 6 ++++- packages/turf-directional-mean/package.json | 6 ++++- packages/turf-dissolve/package.json | 6 ++++- packages/turf-distance-weight/package.json | 6 ++++- packages/turf-distance/package.json | 6 ++++- packages/turf-ellipse/package.json | 6 ++++- packages/turf-envelope/package.json | 6 ++++- packages/turf-explode/package.json | 6 ++++- packages/turf-flatten/package.json | 6 ++++- packages/turf-flip/package.json | 6 ++++- packages/turf-great-circle/package.json | 6 ++++- packages/turf-helpers/package.json | 6 ++++- packages/turf-hex-grid/package.json | 6 ++++- packages/turf-interpolate/package.json | 6 ++++- packages/turf-intersect/package.json | 6 ++++- packages/turf-invariant/package.json | 6 ++++- packages/turf-isobands/package.json | 6 ++++- packages/turf-isolines/package.json | 6 ++++- packages/turf-kinks/package.json | 6 ++++- packages/turf-length/package.json | 6 ++++- packages/turf-line-arc/package.json | 6 ++++- packages/turf-line-chunk/package.json | 6 ++++- packages/turf-line-intersect/package.json | 6 ++++- packages/turf-line-offset/package.json | 6 ++++- packages/turf-line-overlap/package.json | 6 ++++- packages/turf-line-segment/package.json | 6 ++++- packages/turf-line-slice-along/package.json | 6 ++++- packages/turf-line-slice/package.json | 6 ++++- packages/turf-line-split/package.json | 6 ++++- packages/turf-line-to-polygon/package.json | 6 ++++- packages/turf-mask/package.json | 6 ++++- packages/turf-meta/package.json | 6 ++++- packages/turf-midpoint/package.json | 6 ++++- packages/turf-moran-index/package.json | 6 ++++- .../package.json | 6 ++++- .../turf-nearest-point-on-line/package.json | 6 ++++- .../turf-nearest-point-to-line/package.json | 6 ++++- packages/turf-nearest-point/package.json | 6 ++++- packages/turf-planepoint/package.json | 6 ++++- packages/turf-point-grid/package.json | 6 ++++- packages/turf-point-on-feature/package.json | 6 ++++- .../turf-point-to-line-distance/package.json | 6 ++++- .../turf-points-within-polygon/package.json | 6 ++++- packages/turf-polygon-smooth/package.json | 6 ++++- packages/turf-polygon-tangents/package.json | 6 ++++- packages/turf-polygon-to-line/package.json | 6 ++++- packages/turf-polygonize/package.json | 6 ++++- packages/turf-projection/package.json | 6 ++++- packages/turf-quadrat-analysis/package.json | 6 ++++- packages/turf-random/package.json | 6 ++++- packages/turf-rectangle-grid/package.json | 6 ++++- packages/turf-rewind/package.json | 6 ++++- packages/turf-rhumb-bearing/package.json | 6 ++++- packages/turf-rhumb-destination/package.json | 6 ++++- packages/turf-rhumb-distance/package.json | 6 ++++- packages/turf-sample/package.json | 6 ++++- packages/turf-sector/package.json | 6 ++++- packages/turf-shortest-path/package.json | 6 ++++- packages/turf-simplify/package.json | 6 ++++- packages/turf-square-grid/package.json | 6 ++++- packages/turf-square/package.json | 6 ++++- .../package.json | 6 ++++- packages/turf-tag/package.json | 6 ++++- packages/turf-tesselate/package.json | 6 ++++- packages/turf-tin/package.json | 6 ++++- packages/turf-transform-rotate/package.json | 6 ++++- packages/turf-transform-scale/package.json | 6 ++++- .../turf-transform-translate/package.json | 6 ++++- packages/turf-triangle-grid/package.json | 6 ++++- packages/turf-truncate/package.json | 6 ++++- packages/turf-union/package.json | 6 ++++- packages/turf-unkink-polygon/package.json | 6 ++++- packages/turf-voronoi/package.json | 6 ++++- packages/turf/package.json | 6 ++++- scripts/create-new-module | 2 +- scripts/set-uniforms | 2 +- 116 files changed, 588 insertions(+), 119 deletions(-) diff --git a/.monorepolint.config.ts b/.monorepolint.config.ts index 87aa0a1a43..63be0642ae 100644 --- a/.monorepolint.config.ts +++ b/.monorepolint.config.ts @@ -50,6 +50,7 @@ module.exports = { "keywords", "main", "module", + "exports", "browser", "types", "sideEffects", @@ -75,7 +76,11 @@ module.exports = { // Example of a URL that will break: https://unpkg.com/@turf/turf/dist/turf.min.js // Example of a URL that will keep working: https://unpkg.com/@turf/turf browser: "turf.min.js", - files: ["dist", "index.d.ts", "turf.min.js"] + files: ["dist", "index.d.ts", "turf.min.js"], + exports: { + import: "./dist/es/index.js", + require: "./dist/js/index.js" + } } }, includePackages: [MAIN_PACKAGE] @@ -87,7 +92,11 @@ module.exports = { module: "dist/es/index.js", sideEffects: false, publishConfig: { - access: "public" + access: "public", + }, + exports: { + import: "./dist/es/index.js", + require: "./dist/js/index.js" } } }, @@ -131,7 +140,7 @@ module.exports = { prepare: "npm-run-all prepare:*", "prepare:js": "tsc", "prepare:es": - "tsc --outDir dist/es --module esnext --declaration false" + "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json" } }, includePackages: TS_PACKAGES @@ -139,12 +148,20 @@ module.exports = { { options: { scripts: { - prepare: "rollup -c ../../rollup.config.js", + prepare: "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", posttest: "node -r esm ../../scripts/validate-es5-dependencies.js" } }, includePackages: JS_PACKAGES }, + { + options: { + scripts: { + prepare: "rollup -c rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json" + } + }, + includePackages: [MAIN_PACKAGE] + }, { options: { scripts: { diff --git a/packages/turf-along/package.json b/packages/turf-along/package.json index ccfe781e32..b887ebd4d1 100644 --- a/packages/turf-along/package.json +++ b/packages/turf-along/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-angle/package.json b/packages/turf-angle/package.json index 5f4bf5ad24..d3fab17e10 100644 --- a/packages/turf-angle/package.json +++ b/packages/turf-angle/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-area/package.json b/packages/turf-area/package.json index e0325483a5..b2c9c02dd5 100644 --- a/packages/turf-area/package.json +++ b/packages/turf-area/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -33,7 +37,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-bbox-clip/package.json b/packages/turf-bbox-clip/package.json index 971dfb7cc3..43818c95e7 100644 --- a/packages/turf-bbox-clip/package.json +++ b/packages/turf-bbox-clip/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-bbox-polygon/package.json b/packages/turf-bbox-polygon/package.json index 85d6e3c0be..98cd06d3ab 100644 --- a/packages/turf-bbox-polygon/package.json +++ b/packages/turf-bbox-polygon/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-bbox/package.json b/packages/turf-bbox/package.json index ac14aa41d6..4fdf95b084 100644 --- a/packages/turf-bbox/package.json +++ b/packages/turf-bbox/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-bearing/package.json b/packages/turf-bearing/package.json index 5183cc8022..49768f1cad 100644 --- a/packages/turf-bearing/package.json +++ b/packages/turf-bearing/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-bezier-spline/package.json b/packages/turf-bezier-spline/package.json index 68693d9f25..50d0391ed0 100644 --- a/packages/turf-bezier-spline/package.json +++ b/packages/turf-bezier-spline/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-clockwise/package.json b/packages/turf-boolean-clockwise/package.json index 67af551647..e1780e24f2 100755 --- a/packages/turf-boolean-clockwise/package.json +++ b/packages/turf-boolean-clockwise/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-concave/package.json b/packages/turf-boolean-concave/package.json index f5a056faa9..7c2c49c448 100644 --- a/packages/turf-boolean-concave/package.json +++ b/packages/turf-boolean-concave/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-contains/package.json b/packages/turf-boolean-contains/package.json index 7a36290540..f56ada91da 100644 --- a/packages/turf-boolean-contains/package.json +++ b/packages/turf-boolean-contains/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-crosses/package.json b/packages/turf-boolean-crosses/package.json index bc46ae415f..4f35b5e9c3 100644 --- a/packages/turf-boolean-crosses/package.json +++ b/packages/turf-boolean-crosses/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-disjoint/package.json b/packages/turf-boolean-disjoint/package.json index 0f0ab2817b..cf105a6d6a 100644 --- a/packages/turf-boolean-disjoint/package.json +++ b/packages/turf-boolean-disjoint/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-equal/package.json b/packages/turf-boolean-equal/package.json index 8f7fb41dd9..dde983b64e 100644 --- a/packages/turf-boolean-equal/package.json +++ b/packages/turf-boolean-equal/package.json @@ -30,6 +30,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-intersects/package.json b/packages/turf-boolean-intersects/package.json index 3430e27662..29996b74f6 100644 --- a/packages/turf-boolean-intersects/package.json +++ b/packages/turf-boolean-intersects/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-overlap/package.json b/packages/turf-boolean-overlap/package.json index 7fc88a2b5d..72eecc4a96 100755 --- a/packages/turf-boolean-overlap/package.json +++ b/packages/turf-boolean-overlap/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-parallel/package.json b/packages/turf-boolean-parallel/package.json index 9af950ea9d..46d652b74c 100644 --- a/packages/turf-boolean-parallel/package.json +++ b/packages/turf-boolean-parallel/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-point-in-polygon/package.json b/packages/turf-boolean-point-in-polygon/package.json index 1ba6b48068..fd3dbf4cf4 100644 --- a/packages/turf-boolean-point-in-polygon/package.json +++ b/packages/turf-boolean-point-in-polygon/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-point-on-line/package.json b/packages/turf-boolean-point-on-line/package.json index 9ba128a915..b1953889b0 100644 --- a/packages/turf-boolean-point-on-line/package.json +++ b/packages/turf-boolean-point-on-line/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-touches/package.json b/packages/turf-boolean-touches/package.json index 4399e1544f..e693e66d21 100644 --- a/packages/turf-boolean-touches/package.json +++ b/packages/turf-boolean-touches/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-boolean-valid/package.json b/packages/turf-boolean-valid/package.json index 275a154307..07e6045daf 100644 --- a/packages/turf-boolean-valid/package.json +++ b/packages/turf-boolean-valid/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-boolean-within/package.json b/packages/turf-boolean-within/package.json index ea65d03619..80add9bb12 100644 --- a/packages/turf-boolean-within/package.json +++ b/packages/turf-boolean-within/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-buffer/package.json b/packages/turf-buffer/package.json index 5bf398aed0..590c85d169 100644 --- a/packages/turf-buffer/package.json +++ b/packages/turf-buffer/package.json @@ -31,6 +31,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -42,7 +46,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-center-mean/package.json b/packages/turf-center-mean/package.json index 748441e91d..22daa0d73c 100644 --- a/packages/turf-center-mean/package.json +++ b/packages/turf-center-mean/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-center-median/package.json b/packages/turf-center-median/package.json index 0129613b34..8ef0a3a380 100644 --- a/packages/turf-center-median/package.json +++ b/packages/turf-center-median/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-center-of-mass/package.json b/packages/turf-center-of-mass/package.json index 6266b00ed7..e0c4d38db1 100644 --- a/packages/turf-center-of-mass/package.json +++ b/packages/turf-center-of-mass/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-center/package.json b/packages/turf-center/package.json index e784348698..7b8994b883 100644 --- a/packages/turf-center/package.json +++ b/packages/turf-center/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-centroid/package.json b/packages/turf-centroid/package.json index 3a67a2cf8d..5841631e02 100644 --- a/packages/turf-centroid/package.json +++ b/packages/turf-centroid/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -33,7 +37,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-circle/package.json b/packages/turf-circle/package.json index d14b235aa1..7753526b60 100644 --- a/packages/turf-circle/package.json +++ b/packages/turf-circle/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-clean-coords/package.json b/packages/turf-clean-coords/package.json index a705755ef5..f6d2a12b43 100644 --- a/packages/turf-clean-coords/package.json +++ b/packages/turf-clean-coords/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-clone/package.json b/packages/turf-clone/package.json index 221bc8b832..e285c93132 100644 --- a/packages/turf-clone/package.json +++ b/packages/turf-clone/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-clusters-dbscan/package.json b/packages/turf-clusters-dbscan/package.json index 4b7f82f566..33e57b0a15 100644 --- a/packages/turf-clusters-dbscan/package.json +++ b/packages/turf-clusters-dbscan/package.json @@ -31,6 +31,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -41,7 +45,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-clusters-kmeans/package.json b/packages/turf-clusters-kmeans/package.json index 03c37d7abf..0026e35847 100644 --- a/packages/turf-clusters-kmeans/package.json +++ b/packages/turf-clusters-kmeans/package.json @@ -30,6 +30,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-clusters/package.json b/packages/turf-clusters/package.json index 44a375b919..faa0059aea 100644 --- a/packages/turf-clusters/package.json +++ b/packages/turf-clusters/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-collect/package.json b/packages/turf-collect/package.json index 0c2942fef6..106582ea65 100644 --- a/packages/turf-collect/package.json +++ b/packages/turf-collect/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-combine/package.json b/packages/turf-combine/package.json index f0dd14cb92..37063795cd 100644 --- a/packages/turf-combine/package.json +++ b/packages/turf-combine/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-concave/package.json b/packages/turf-concave/package.json index 0c7bf6462d..3d9be72f02 100644 --- a/packages/turf-concave/package.json +++ b/packages/turf-concave/package.json @@ -34,6 +34,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -44,7 +48,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-convex/package.json b/packages/turf-convex/package.json index 2895a7d746..854d14d65c 100644 --- a/packages/turf-convex/package.json +++ b/packages/turf-convex/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-destination/package.json b/packages/turf-destination/package.json index 7754c70265..245d3a7939 100644 --- a/packages/turf-destination/package.json +++ b/packages/turf-destination/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-difference/package.json b/packages/turf-difference/package.json index 410296cda8..a224c680e4 100644 --- a/packages/turf-difference/package.json +++ b/packages/turf-difference/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-directional-mean/package.json b/packages/turf-directional-mean/package.json index 9de2348422..b1de1f6560 100644 --- a/packages/turf-directional-mean/package.json +++ b/packages/turf-directional-mean/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-dissolve/package.json b/packages/turf-dissolve/package.json index 07ab930099..17280e3d3b 100644 --- a/packages/turf-dissolve/package.json +++ b/packages/turf-dissolve/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-distance-weight/package.json b/packages/turf-distance-weight/package.json index 92615d8db3..d198b6ed7b 100644 --- a/packages/turf-distance-weight/package.json +++ b/packages/turf-distance-weight/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-distance/package.json b/packages/turf-distance/package.json index f561423bde..f2523ac330 100644 --- a/packages/turf-distance/package.json +++ b/packages/turf-distance/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -33,7 +37,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-ellipse/package.json b/packages/turf-ellipse/package.json index f426fd944d..f39c82f35c 100644 --- a/packages/turf-ellipse/package.json +++ b/packages/turf-ellipse/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-envelope/package.json b/packages/turf-envelope/package.json index fab4b2fbad..9f21046558 100644 --- a/packages/turf-envelope/package.json +++ b/packages/turf-envelope/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-explode/package.json b/packages/turf-explode/package.json index 8d0d92fed3..531ff46021 100644 --- a/packages/turf-explode/package.json +++ b/packages/turf-explode/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-flatten/package.json b/packages/turf-flatten/package.json index 7c9b8f2164..f7d016c6d4 100644 --- a/packages/turf-flatten/package.json +++ b/packages/turf-flatten/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-flip/package.json b/packages/turf-flip/package.json index 8c545d4537..f4f1109064 100644 --- a/packages/turf-flip/package.json +++ b/packages/turf-flip/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-great-circle/package.json b/packages/turf-great-circle/package.json index 80176dbe05..32a975e487 100644 --- a/packages/turf-great-circle/package.json +++ b/packages/turf-great-circle/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-helpers/package.json b/packages/turf-helpers/package.json index bbaadb1770..c674c25823 100644 --- a/packages/turf-helpers/package.json +++ b/packages/turf-helpers/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-hex-grid/package.json b/packages/turf-hex-grid/package.json index 81974a894e..9c80cf417e 100644 --- a/packages/turf-hex-grid/package.json +++ b/packages/turf-hex-grid/package.json @@ -33,6 +33,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -43,7 +47,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-interpolate/package.json b/packages/turf-interpolate/package.json index 4c96418267..5d6ae875a0 100644 --- a/packages/turf-interpolate/package.json +++ b/packages/turf-interpolate/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-intersect/package.json b/packages/turf-intersect/package.json index 437154905f..18e4528680 100644 --- a/packages/turf-intersect/package.json +++ b/packages/turf-intersect/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-invariant/package.json b/packages/turf-invariant/package.json index ed94c3e78d..08b1a2c6d4 100644 --- a/packages/turf-invariant/package.json +++ b/packages/turf-invariant/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-isobands/package.json b/packages/turf-isobands/package.json index 29e880479f..35f948fcec 100644 --- a/packages/turf-isobands/package.json +++ b/packages/turf-isobands/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-isolines/package.json b/packages/turf-isolines/package.json index f711f19378..b2775a40c8 100644 --- a/packages/turf-isolines/package.json +++ b/packages/turf-isolines/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-kinks/package.json b/packages/turf-kinks/package.json index f1854d2ac5..c4e2c2eb71 100644 --- a/packages/turf-kinks/package.json +++ b/packages/turf-kinks/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-length/package.json b/packages/turf-length/package.json index d11148cb45..75e42d73ae 100644 --- a/packages/turf-length/package.json +++ b/packages/turf-length/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-line-arc/package.json b/packages/turf-line-arc/package.json index 19b18418fa..67a1f5c62d 100644 --- a/packages/turf-line-arc/package.json +++ b/packages/turf-line-arc/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-line-chunk/package.json b/packages/turf-line-chunk/package.json index 6987858d70..df4bed9b56 100644 --- a/packages/turf-line-chunk/package.json +++ b/packages/turf-line-chunk/package.json @@ -30,6 +30,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -41,7 +45,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-line-intersect/package.json b/packages/turf-line-intersect/package.json index c73cf557fc..d2131bcdd8 100644 --- a/packages/turf-line-intersect/package.json +++ b/packages/turf-line-intersect/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-line-offset/package.json b/packages/turf-line-offset/package.json index fdbbd571a7..5ea16a9f97 100644 --- a/packages/turf-line-offset/package.json +++ b/packages/turf-line-offset/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-line-overlap/package.json b/packages/turf-line-overlap/package.json index 22b6bd3d2c..eb65ca33cd 100644 --- a/packages/turf-line-overlap/package.json +++ b/packages/turf-line-overlap/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-line-segment/package.json b/packages/turf-line-segment/package.json index 36d81e1f6f..a0a0aeaafc 100644 --- a/packages/turf-line-segment/package.json +++ b/packages/turf-line-segment/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-line-slice-along/package.json b/packages/turf-line-slice-along/package.json index ef706a446b..cd16ebb3bf 100644 --- a/packages/turf-line-slice-along/package.json +++ b/packages/turf-line-slice-along/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -33,7 +37,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-line-slice/package.json b/packages/turf-line-slice/package.json index fdd5d4904c..46a2d81e6a 100644 --- a/packages/turf-line-slice/package.json +++ b/packages/turf-line-slice/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-line-split/package.json b/packages/turf-line-split/package.json index 4d3c9205de..bf68f5caf3 100644 --- a/packages/turf-line-split/package.json +++ b/packages/turf-line-split/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-line-to-polygon/package.json b/packages/turf-line-to-polygon/package.json index 06482fcee0..715d16d121 100644 --- a/packages/turf-line-to-polygon/package.json +++ b/packages/turf-line-to-polygon/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-mask/package.json b/packages/turf-mask/package.json index 685e9f163f..325c701444 100644 --- a/packages/turf-mask/package.json +++ b/packages/turf-mask/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -33,7 +37,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-meta/package.json b/packages/turf-meta/package.json index 17a9480a19..0f526f2380 100644 --- a/packages/turf-meta/package.json +++ b/packages/turf-meta/package.json @@ -44,6 +44,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -55,7 +59,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-midpoint/package.json b/packages/turf-midpoint/package.json index 5406e81b3c..d94f656ae9 100644 --- a/packages/turf-midpoint/package.json +++ b/packages/turf-midpoint/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-moran-index/package.json b/packages/turf-moran-index/package.json index 744a11fc87..4e3adf835d 100644 --- a/packages/turf-moran-index/package.json +++ b/packages/turf-moran-index/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-nearest-neighbor-analysis/package.json b/packages/turf-nearest-neighbor-analysis/package.json index 24d734306d..2c9992a851 100644 --- a/packages/turf-nearest-neighbor-analysis/package.json +++ b/packages/turf-nearest-neighbor-analysis/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-nearest-point-on-line/package.json b/packages/turf-nearest-point-on-line/package.json index 63ad4ae9bb..a1a56c591e 100644 --- a/packages/turf-nearest-point-on-line/package.json +++ b/packages/turf-nearest-point-on-line/package.json @@ -17,6 +17,10 @@ }, "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -27,7 +31,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-nearest-point-to-line/package.json b/packages/turf-nearest-point-to-line/package.json index 09ea02c468..8747e28661 100644 --- a/packages/turf-nearest-point-to-line/package.json +++ b/packages/turf-nearest-point-to-line/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-nearest-point/package.json b/packages/turf-nearest-point/package.json index 4bf74a591a..20ae3bf44d 100644 --- a/packages/turf-nearest-point/package.json +++ b/packages/turf-nearest-point/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-planepoint/package.json b/packages/turf-planepoint/package.json index 07dedb2e08..0899eaa843 100644 --- a/packages/turf-planepoint/package.json +++ b/packages/turf-planepoint/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-point-grid/package.json b/packages/turf-point-grid/package.json index b4e0cbd6c8..7f85b31507 100644 --- a/packages/turf-point-grid/package.json +++ b/packages/turf-point-grid/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-point-on-feature/package.json b/packages/turf-point-on-feature/package.json index b3e3d0be1a..0a91b6c8ff 100644 --- a/packages/turf-point-on-feature/package.json +++ b/packages/turf-point-on-feature/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-point-to-line-distance/package.json b/packages/turf-point-to-line-distance/package.json index de52cd0b64..b8cd623d27 100644 --- a/packages/turf-point-to-line-distance/package.json +++ b/packages/turf-point-to-line-distance/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-points-within-polygon/package.json b/packages/turf-points-within-polygon/package.json index 9b7a306f5c..93f37ce076 100644 --- a/packages/turf-points-within-polygon/package.json +++ b/packages/turf-points-within-polygon/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-polygon-smooth/package.json b/packages/turf-polygon-smooth/package.json index bfa6fc8db8..00b4e25323 100644 --- a/packages/turf-polygon-smooth/package.json +++ b/packages/turf-polygon-smooth/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-polygon-tangents/package.json b/packages/turf-polygon-tangents/package.json index f26e997a76..0592da37f3 100644 --- a/packages/turf-polygon-tangents/package.json +++ b/packages/turf-polygon-tangents/package.json @@ -28,6 +28,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-polygon-to-line/package.json b/packages/turf-polygon-to-line/package.json index b752597069..fc31e1e86b 100644 --- a/packages/turf-polygon-to-line/package.json +++ b/packages/turf-polygon-to-line/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-polygonize/package.json b/packages/turf-polygonize/package.json index 4a8a7e50c3..8c13ccb3b0 100644 --- a/packages/turf-polygonize/package.json +++ b/packages/turf-polygonize/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-projection/package.json b/packages/turf-projection/package.json index 47044b271e..596ed9270a 100644 --- a/packages/turf-projection/package.json +++ b/packages/turf-projection/package.json @@ -35,6 +35,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -45,7 +49,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-quadrat-analysis/package.json b/packages/turf-quadrat-analysis/package.json index b7f9629fc4..aca19ee1f7 100644 --- a/packages/turf-quadrat-analysis/package.json +++ b/packages/turf-quadrat-analysis/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-random/package.json b/packages/turf-random/package.json index 8d30e4483d..7854fd2a3d 100644 --- a/packages/turf-random/package.json +++ b/packages/turf-random/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-rectangle-grid/package.json b/packages/turf-rectangle-grid/package.json index 22626d8c8f..64be1c8e8f 100644 --- a/packages/turf-rectangle-grid/package.json +++ b/packages/turf-rectangle-grid/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-rewind/package.json b/packages/turf-rewind/package.json index dbc448f33f..3093cc548a 100644 --- a/packages/turf-rewind/package.json +++ b/packages/turf-rewind/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-rhumb-bearing/package.json b/packages/turf-rhumb-bearing/package.json index 25aaf33f2b..016835daf2 100644 --- a/packages/turf-rhumb-bearing/package.json +++ b/packages/turf-rhumb-bearing/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -39,7 +43,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-rhumb-destination/package.json b/packages/turf-rhumb-destination/package.json index c5c3aa5e84..0b5e6c4bab 100644 --- a/packages/turf-rhumb-destination/package.json +++ b/packages/turf-rhumb-destination/package.json @@ -33,6 +33,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -43,7 +47,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-rhumb-distance/package.json b/packages/turf-rhumb-distance/package.json index 724f23e95d..072fb8bc79 100644 --- a/packages/turf-rhumb-distance/package.json +++ b/packages/turf-rhumb-distance/package.json @@ -31,6 +31,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -41,7 +45,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-sample/package.json b/packages/turf-sample/package.json index cb3fee0f1a..0ae3d1ea9d 100644 --- a/packages/turf-sample/package.json +++ b/packages/turf-sample/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-sector/package.json b/packages/turf-sector/package.json index d85392af27..4a31ccbd27 100644 --- a/packages/turf-sector/package.json +++ b/packages/turf-sector/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-shortest-path/package.json b/packages/turf-shortest-path/package.json index 0625abdd58..ef86f8ba4c 100644 --- a/packages/turf-shortest-path/package.json +++ b/packages/turf-shortest-path/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-simplify/package.json b/packages/turf-simplify/package.json index fbe5ad55b0..4aaba213dd 100644 --- a/packages/turf-simplify/package.json +++ b/packages/turf-simplify/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-square-grid/package.json b/packages/turf-square-grid/package.json index febb54062b..a417cd3751 100644 --- a/packages/turf-square-grid/package.json +++ b/packages/turf-square-grid/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" diff --git a/packages/turf-square/package.json b/packages/turf-square/package.json index f1a3de4405..c8ff703529 100644 --- a/packages/turf-square/package.json +++ b/packages/turf-square/package.json @@ -23,6 +23,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -34,7 +38,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-standard-deviational-ellipse/package.json b/packages/turf-standard-deviational-ellipse/package.json index b4cd248a6c..9115e3b9a2 100644 --- a/packages/turf-standard-deviational-ellipse/package.json +++ b/packages/turf-standard-deviational-ellipse/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -37,7 +41,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-tag/package.json b/packages/turf-tag/package.json index 4602a54cf7..8b743da071 100644 --- a/packages/turf-tag/package.json +++ b/packages/turf-tag/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-tesselate/package.json b/packages/turf-tesselate/package.json index 27c1272829..61c952ff67 100644 --- a/packages/turf-tesselate/package.json +++ b/packages/turf-tesselate/package.json @@ -31,6 +31,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -42,7 +46,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf-tin/package.json b/packages/turf-tin/package.json index c21ca7dcfc..240c6a563e 100644 --- a/packages/turf-tin/package.json +++ b/packages/turf-tin/package.json @@ -22,6 +22,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -32,7 +36,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-transform-rotate/package.json b/packages/turf-transform-rotate/package.json index c50d8ae8f3..2895241ac9 100644 --- a/packages/turf-transform-rotate/package.json +++ b/packages/turf-transform-rotate/package.json @@ -27,6 +27,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -38,7 +42,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-transform-scale/package.json b/packages/turf-transform-scale/package.json index f249fe456f..e632dd51f3 100644 --- a/packages/turf-transform-scale/package.json +++ b/packages/turf-transform-scale/package.json @@ -31,6 +31,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -42,7 +46,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-transform-translate/package.json b/packages/turf-transform-translate/package.json index 0cf445b30a..fc8cdbfbe3 100644 --- a/packages/turf-transform-translate/package.json +++ b/packages/turf-transform-translate/package.json @@ -29,6 +29,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -40,7 +44,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-triangle-grid/package.json b/packages/turf-triangle-grid/package.json index 0f9d87ff53..a83ec2a9eb 100644 --- a/packages/turf-triangle-grid/package.json +++ b/packages/turf-triangle-grid/package.json @@ -25,6 +25,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-truncate/package.json b/packages/turf-truncate/package.json index a0048e5e12..63124ec22a 100644 --- a/packages/turf-truncate/package.json +++ b/packages/turf-truncate/package.json @@ -26,6 +26,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -36,7 +40,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-union/package.json b/packages/turf-union/package.json index 6d0b00a6bf..638eaabfc1 100644 --- a/packages/turf-union/package.json +++ b/packages/turf-union/package.json @@ -21,6 +21,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "dist/js/index.d.ts", "sideEffects": false, "files": [ @@ -31,7 +35,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "prepare": "npm-run-all prepare:*", - "prepare:es": "tsc --outDir dist/es --module esnext --declaration false", + "prepare:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", "prepare:js": "tsc", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", diff --git a/packages/turf-unkink-polygon/package.json b/packages/turf-unkink-polygon/package.json index cc1b402ada..812c4fbdbd 100644 --- a/packages/turf-unkink-polygon/package.json +++ b/packages/turf-unkink-polygon/package.json @@ -24,6 +24,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -35,7 +39,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js", "test:types": "tsc --noEmit types.ts" diff --git a/packages/turf-voronoi/package.json b/packages/turf-voronoi/package.json index 5574aa01e8..d4be5447b5 100644 --- a/packages/turf-voronoi/package.json +++ b/packages/turf-voronoi/package.json @@ -30,6 +30,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "types": "index.d.ts", "sideEffects": false, "files": [ @@ -41,7 +45,7 @@ "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", - "prepare": "rollup -c ../../rollup.config.js", + "prepare": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "test": "npm-run-all prepare test:*", "test:tape": "node -r esm test.js" }, diff --git a/packages/turf/package.json b/packages/turf/package.json index 46b6f520d3..77d6611624 100644 --- a/packages/turf/package.json +++ b/packages/turf/package.json @@ -44,6 +44,10 @@ ], "main": "dist/js/index.js", "module": "dist/es/index.js", + "exports": { + "import": "./dist/es/index.js", + "require": "./dist/js/index.js" + }, "browser": "turf.min.js", "types": "index.d.ts", "sideEffects": false, @@ -56,7 +60,7 @@ "last-checks": "npm-run-all last-checks:testjs last-checks:example", "last-checks:example": "node test.example.js", "last-checks:testjs": "node test.js", - "prepare": "rollup -c rollup.config.js", + "prepare": "rollup -c rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", "pretest": "npm-run-all prepare", "test": "echo '@turf/turf tests run in the last-checks step'" }, diff --git a/scripts/create-new-module b/scripts/create-new-module index 24e62f59f0..935712d1be 100755 --- a/scripts/create-new-module +++ b/scripts/create-new-module @@ -62,7 +62,7 @@ fs.writeFileSync(path.join(folderPath, 'package.json'), `{ "main.es.js" ], "scripts": { - "pretest": "rollup -c ../../rollup.config.js", + "pretest": "rollup -c ../../rollup.config.js && echo '{"type":"module"}' > dist/es/package.json", "test": "node -r @std/esm test.js", "posttest": "node -r @std/esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r @std/esm bench.js", diff --git a/scripts/set-uniforms b/scripts/set-uniforms index 1b7bf7b736..4b78ec7443 100755 --- a/scripts/set-uniforms +++ b/scripts/set-uniforms @@ -24,7 +24,7 @@ glob.sync(path.join(__dirname, '..', 'packages', 'turf-*', 'package.json')).forE types: 'index.d.ts', files: [...files], scripts: { - 'pretest': 'rollup -c ../../rollup.config.js', + 'pretest': 'rollup -c ../../rollup.config.js && echo \'{"type":"module"}\' > dist/es/package.json', 'test': 'node -r @std/esm test.js', 'posttest': 'node -r @std/esm ../../scripts/validate-es5-dependencies.js', 'bench': 'node -r @std/esm bench.js',