Skip to content
Draft
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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches:
- master
- support/6.x
- support/7.x
pull_request:
branches:
- master
- support/6.x
- support/7.x

permissions:
contents: read
Expand All @@ -21,6 +21,8 @@ jobs:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x, 24.x, 26.x]
exclude:
- node-version: ${{ (github.base_ref || github.ref_name) == 'master' && '18.x' || 'none' }}

steps:
- name: Checkout
Expand Down
47 changes: 17 additions & 30 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export default {
"publishConfig",
"keywords",
"type",
"main",
"module",
"types",
"exports",
"browser",
"sideEffects",
Expand All @@ -87,9 +84,9 @@ export default {
options: {
entries: {
type: "module",
main: "dist/cjs/index.cjs",
module: "dist/esm/index.js",
types: "dist/esm/index.d.ts",
main: REMOVE,
module: REMOVE,
types: REMOVE,
sideEffects: false,
publishConfig: {
access: "public",
Expand All @@ -103,14 +100,10 @@ export default {
exports: {
"./package.json": "./package.json",
".": {
import: {
types: "./dist/esm/index.d.ts",
default: "./dist/esm/index.js",
},
require: {
types: "./dist/cjs/index.d.cts",
default: "./dist/cjs/index.cjs",
},
types: "./dist/index.d.ts",
default: "./dist/index.js",
require: REMOVE,
import: REMOVE,
},
},
},
Expand All @@ -122,24 +115,20 @@ export default {
options: {
entries: {
type: "module",
main: "dist/cjs/index.cjs",
module: "dist/esm/index.js",
types: "dist/esm/index.d.ts",
main: REMOVE,
module: REMOVE,
types: REMOVE,
sideEffects: false,
publishConfig: {
access: "public",
},
exports: {
"./package.json": "./package.json",
".": {
import: {
types: "./dist/esm/index.d.ts",
default: "./dist/esm/index.js",
},
require: {
types: "./dist/cjs/index.d.cts",
default: "./dist/cjs/index.cjs",
},
types: "./dist/index.d.ts",
default: "./dist/index.js",
require: REMOVE,
import: REMOVE,
},
},
},
Expand Down Expand Up @@ -177,7 +166,7 @@ export default {
packageScript({
options: {
scripts: {
build: "tsup --config ../../tsup.config.ts",
build: "tsc",
},
},
includePackages: PACKAGES,
Expand All @@ -186,8 +175,7 @@ export default {
packageScript({
options: {
scripts: {
build:
"tsup --config ../../tsup.config.ts && rollup -c rollup.config.js",
build: "tsc && rollup -c rollup.config.js",
},
},
includePackages: [MAIN_PACKAGE],
Expand Down Expand Up @@ -228,7 +216,6 @@ export default {
benchmark: "catalog:",
glob: REMOVE,
tape: "catalog:",
tsup: "catalog:",
tsx: "catalog:",
},
},
Expand All @@ -238,7 +225,7 @@ export default {
requireDependency({
options: {
dependencies: {
tslib: "catalog:",
tslib: REMOVE,
},
devDependencies: {
"@types/benchmark": "catalog:",
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ export default tsEslint.config(
"prefer-const": "off",
},
},

// ban top-level await in our source files
// Node's commonjs require() of ESM syntax requires that they be synchronous
{
files: ["packages/*/index.ts", "packages/*/lib/**/*.ts"],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
"AwaitExpression[argument.type!='AwaitExpression'][parent.type!='FunctionExpression'][parent.type!='FunctionDeclaration'][parent.type!='ArrowFunctionExpression']",
message: "Top-level await is not allowed.",
},
],
},
},
{
files: ["packages/*/types.ts", "packages/*/test.ts"],

Expand Down
3 changes: 1 addition & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"inputs": [
"default",
"sources",
"{workspaceRoot}/tsup.config.ts",
"{projectRoot}/index.d.ts",
"{workspaceRoot}/tsconfig.shared.json",
"{projectRoot}/rollup.config.cjs"
],
"outputs": ["{projectRoot}/dist"],
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"docs": "node ./scripts/generate-readmes.mts",
"lint": "pnpm run /lint:.*/",
"lint:docs": "documentation lint packages/turf-*/index.js",
"lint:escheck-cjs": "es-check es8 packages/*/dist/cjs/index.cjs packages/turf/turf.min.js",
"lint:escheck-esm": "es-check --module es8 packages/*/dist/esm/index.js",
"lint:escheck-web": "es-check es5 packages/turf/turf.min.js",
Comment on lines -8 to -10
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

escheck-cjs is no longer necessary because we're dropping cjs builds in this PR.

escheck-web is only necessary if you don't trust the Rollup step to output valid syntax. It has caught some things in the past where newer rollups ship catch{} syntax which isn't es5, but we're also going to move this way forward to es2022 or similar with Turf@8.

escheck-esm is no longer necessary and we are instead protected by tsconfig.shared.json's target of es2022 (in this PR). TypeScript will prevent us from using syntax that isn't supported at this version (which aligns with the tsconfig suggestions for node 22.

"lint:eslint": "eslint packages",
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
Expand Down Expand Up @@ -43,7 +40,6 @@
"decamelize": "^6.0.0",
"dependency-tree": "^11.1.1",
"documentation": "^14.0.3",
"es-check": "^9.0.0",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.3",
Expand All @@ -57,7 +53,6 @@
"meow": "^13.2.0",
"prettier": "^3.5.3",
"progress": "^2.0.3",
"tsup": "^8.4.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.38.0",
"yaml": "^2.8.2"
Expand Down
19 changes: 4 additions & 15 deletions packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,11 @@
"distance"
],
"type": "module",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
Expand All @@ -46,7 +37,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsc",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
},
Expand All @@ -56,7 +47,6 @@
"benchmark": "catalog:",
"load-json-file": "^7.0.1",
"tape": "catalog:",
"tsup": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:"
},
Expand All @@ -66,7 +56,6 @@
"@turf/distance": "workspace:*",
"@turf/helpers": "workspace:*",
"@turf/invariant": "workspace:*",
"@types/geojson": "catalog:",
"tslib": "catalog:"
"@types/geojson": "catalog:"
}
}
19 changes: 4 additions & 15 deletions packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,11 @@
"angle"
],
"type": "module",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
Expand All @@ -46,7 +37,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsc",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
},
Expand All @@ -59,7 +50,6 @@
"benchmark": "catalog:",
"load-json-file": "^7.0.1",
"tape": "catalog:",
"tsup": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"write-json-file": "^6.0.0"
Expand All @@ -69,7 +59,6 @@
"@turf/helpers": "workspace:*",
"@turf/invariant": "workspace:*",
"@turf/rhumb-bearing": "workspace:*",
"@types/geojson": "catalog:",
"tslib": "catalog:"
"@types/geojson": "catalog:"
}
}
19 changes: 4 additions & 15 deletions packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,11 @@
"multipolygon"
],
"type": "module",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
Expand All @@ -45,7 +36,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsc",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
},
Expand All @@ -55,15 +46,13 @@
"benchmark": "catalog:",
"load-json-file": "^7.0.1",
"tape": "catalog:",
"tsup": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"write-json-file": "^6.0.0"
},
"dependencies": {
"@turf/helpers": "workspace:*",
"@turf/meta": "workspace:*",
"@types/geojson": "catalog:",
"tslib": "catalog:"
"@types/geojson": "catalog:"
}
}
19 changes: 4 additions & 15 deletions packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,11 @@
"clip"
],
"type": "module",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
Expand All @@ -51,7 +42,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsc",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
},
Expand All @@ -62,15 +53,13 @@
"benchmark": "catalog:",
"load-json-file": "^7.0.1",
"tape": "catalog:",
"tsup": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"write-json-file": "^6.0.0"
},
"dependencies": {
"@turf/helpers": "workspace:*",
"@turf/invariant": "workspace:*",
"@types/geojson": "catalog:",
"tslib": "catalog:"
"@types/geojson": "catalog:"
}
}
Loading
Loading