Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node ESM compatibility #1942

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .monorepolint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = {
"keywords",
"main",
"module",
"exports",
"browser",
"types",
"sideEffects",
Expand All @@ -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]
Expand All @@ -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"
}
}
},
Expand Down Expand Up @@ -131,20 +140,28 @@ 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
},
{
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: {
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-bearing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-bezier-spline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-clockwise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-concave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-contains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-crosses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-disjoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-equal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-intersects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion packages/turf-boolean-overlap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
Expand Down
Loading