Migration to pnpm and improved exports strategy (#2555)

* Moving to pnpm as package manager. Also taking the opportunity to tidy up our cjs / esm situation using tsup (instead of tsc and rollup). Can't get monorepolint to work with new setup so disabling for the time being.

* Changing all Turf imports to use named imports. Adding a few missing named exports. Updating github workflow actions to pnpm instead of yarn.

* Updating typescript module and moduleResolution mechanisms to "node16". Not tracking nodenext just yet. Changing tsup command to generate d.ts files that arethetypeswrong approves of.

* Tweaking github workflows to explicitely install pnpm.

* Looks like node needs the chosen cache binary installed first. Trying without cache as a first step.

* Seem to be hitting the tsx bug described here: https://github.com/privatenumber/tsx/issues/421 Upgrading to latest tsx to remedy.

* Forgot to update lock file after updating tsx dep in package.json files.

* Sorting modules exported from @turf/turf alphabetically. Preparatory commit to add unexported modules.

* Converting index.mjs to typescript, and simplifying re-exported imports, and ordering alphabetically. Added in a couple of packages - convex, booleanValid and nearestNeighbourAnalysis. Rollup now only used in packages/turf so merging project root base config into there. Also now only using rollup in packages/turf to do final conversion to web module. JS and d.ts files generated the same as other modules, using tsup.

* Including tslib in @turf/turf build now that it's a TS module.

* Lot of per-package tsconfig items now on the tsup command line, so stripping back tsconfig.json to the bare minimum. Adding tsconfig.json to packages that while still only JS, are now processed by tsup.

* Same as last commit - simplifying tsconfig.json - except these are the subset of packages that had multiple entry points e.g. 3rd party code hosted locally in lib/

* Incorporating some suggestions from @favna on being more explicit with d.ts entries. https://github.com/Turfjs/turf/issues/2307#issuecomment-1858653048  Specifying overall module type as commonjs explicitly.

* Reapplying cjsInterop / splitting workaround for CJS exports that we had on build target command line earlier in this PR in to tsup config file. Also disabling treeshaking as this was generating a warning for CJS files and causing the workaround above to not work.

* Upgrading rollup and related plugins. Updating to recommended modern browserslist config in babel.config.json e.g. previous chrome 67 and edge 17 are 5 years old, ie11 is just ... ugh

* Fluffed the browserslist config - need to cover es5 as well.

* Update .github/workflows/turf.yml to use actions/checkout v4.

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>

---------

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
This commit is contained in:
James Beard 2023-12-19 10:14:18 +11:00 committed by GitHub
parent d83e5801ac
commit 4ea81e6b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
398 changed files with 20868 additions and 14023 deletions

View File

@ -18,13 +18,20 @@ jobs:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn --frozen-lockfile
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- run: pnpm install --frozen-lockfile
- run: git diff --exit-code
- run: yarn test
- run: pnpm test

View File

@ -17,3 +17,5 @@ packages/turf-*/test/in/**
packages/turf-*/test/out/**
packages/turf-*/test/true/**
packages/turf-*/test/false/**
pnpm-lock.yaml

View File

@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"npmClient": "pnpm",
"version": "7.0.0-alpha.2",
"command": {
"publish": {

View File

@ -1,22 +1,18 @@
{
"private": true,
"workspaces": [
"packages/*"
],
"funding": "https://opencollective.com/turf",
"scripts": {
"lint": "npm-run-all lint:*",
"lint:eslint": "eslint packages",
"lint:prettier": "prettier --check .",
"lint:mrl": "mrl check",
"lint:escheck-require": "es-check es8 packages/*/dist/js/index.js packages/turf/turf.min.js",
"lint:escheck-esm": "es-check --module es8 packages/*/dist/es/index.js",
"lint:escheck-es5": "es-check es5 packages/turf/turf.min.js",
"postlint": "documentation lint packages/turf-*/index.js",
"prepare": "lerna run build && node ./scripts/add-import-extensions.js",
"pretest": "npm run lint",
"test": "lerna run test",
"posttest": "lerna run --scope @turf/turf last-checks",
"lintDISABLED:mrl": "mrl check",
"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.mjs",
"lint:escheck-web": "es-check es5 packages/turf/turf.min.js",
"lint:docs": "documentation lint packages/turf-*/index.js packages/turf-*/index.mjs",
"preinstall": "npx only-allow pnpm",
"prepare": "lerna run build",
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks",
"docs": "tsx ./scripts/generate-readmes.ts"
},
"husky": {
@ -63,9 +59,9 @@
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"progress": "^2.0.3",
"rollup": "^2.79.1",
"ts-node": "^9.0.0",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"yamljs": "^0.3.0"
}

View File

@ -1,7 +1,7 @@
import { Feature, LineString, Point } from "geojson";
import bearing from "@turf/bearing";
import destination from "@turf/destination";
import measureDistance from "@turf/distance";
import { bearing } from "@turf/bearing";
import { destination } from "@turf/destination";
import { distance as measureDistance } from "@turf/distance";
import { point, Units } from "@turf/helpers";
import { getGeom } from "@turf/invariant";

View File

@ -23,26 +23,30 @@
"turf",
"distance"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -54,15 +58,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/bearing": "^7.0.0-alpha.2",
"@turf/destination": "^7.0.0-alpha.2",
"@turf/distance": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/bearing": "workspace:^",
"@turf/destination": "workspace:^",
"@turf/distance": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"],
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,6 +1,6 @@
import bearing from "@turf/bearing";
import { bearing } from "@turf/bearing";
import { bearingToAzimuth, Coord, isObject } from "@turf/helpers";
import rhumbBearing from "@turf/rhumb-bearing";
import { rhumbBearing } from "@turf/rhumb-bearing";
/**
* Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise)

View File

@ -23,34 +23,38 @@
"turf",
"angle"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
},
"devDependencies": {
"@turf/distance": "^7.0.0-alpha.2",
"@turf/sector": "^7.0.0-alpha.2",
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/distance": "workspace:^",
"@turf/sector": "workspace:^",
"@turf/truncate": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
@ -58,15 +62,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/bearing": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/rhumb-bearing": "^7.0.0-alpha.2",
"@turf/bearing": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/rhumb-bearing": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -3,7 +3,7 @@ import path from "path";
import { glob } from "glob";
import { loadJsonFileSync } from "load-json-file";
import { writeJsonFileSync } from "write-json-file";
import sector from "@turf/sector";
import { sector } from "@turf/sector";
import { bearing } from "@turf/bearing";
import { truncate } from "@turf/truncate";
import { distance } from "@turf/distance";

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -22,26 +22,30 @@
"polygon",
"multipolygon"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -53,13 +57,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -106,12 +106,12 @@ function intersect(
return edge & 8
? [a[0] + ((b[0] - a[0]) * (bbox[3] - a[1])) / (b[1] - a[1]), bbox[3]] // top
: edge & 4
? [a[0] + ((b[0] - a[0]) * (bbox[1] - a[1])) / (b[1] - a[1]), bbox[1]] // bottom
: edge & 2
? [bbox[2], a[1] + ((b[1] - a[1]) * (bbox[2] - a[0])) / (b[0] - a[0])] // right
: edge & 1
? [bbox[0], a[1] + ((b[1] - a[1]) * (bbox[0] - a[0])) / (b[0] - a[0])] // left
: null;
? [a[0] + ((b[0] - a[0]) * (bbox[1] - a[1])) / (b[1] - a[1]), bbox[1]] // bottom
: edge & 2
? [bbox[2], a[1] + ((b[1] - a[1]) * (bbox[2] - a[0])) / (b[0] - a[0])] // right
: edge & 1
? [bbox[0], a[1] + ((b[1] - a[1]) * (bbox[0] - a[0])) / (b[0] - a[0])] // left
: null;
}
// bit code reflects the point position relative to the bbox:

View File

@ -28,45 +28,50 @@
"bbox",
"clip"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
},
"devDependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts", "lib/lineclip.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -23,26 +23,30 @@
"extent",
"bbox"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -53,11 +57,12 @@
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,6 +1,6 @@
import Benchmark from "benchmark";
import { lineString } from "@turf/helpers";
import bbox from "./index";
import { bbox } from "./index";
const line = lineString([
[-74, 40],

View File

@ -24,26 +24,30 @@
"featurecollection",
"geojson"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -54,12 +58,13 @@
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -20,44 +20,49 @@
"turf",
"bearing"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
},
"devDependencies": {
"@turf/destination": "^7.0.0-alpha.2",
"@turf/destination": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -2,7 +2,7 @@ import fs from "fs";
import path from "path";
import { loadJsonFileSync } from "load-json-file";
import Benchmark from "benchmark";
import { bezier as bezierSpline } from "./index";
import { bezierSpline } from "./index";
const directory = path.join(__dirname, "test", "in") + path.sep;
const fixtures = fs.readdirSync(directory).map((filename) => {

View File

@ -1,7 +1,7 @@
import { Feature, LineString, GeoJsonProperties } from "geojson";
import { lineString } from "@turf/helpers";
import { getGeom } from "@turf/invariant";
import Spline from "./lib/spline";
import { Spline } from "./lib/spline";
/**
* Takes a {@link LineString|line} and returns a curved version
@ -33,7 +33,7 @@ import Spline from "./lib/spline";
* var addToMap = [line, curved]
* curved.properties = { stroke: '#0F0' };
*/
function bezier<P extends GeoJsonProperties = GeoJsonProperties>(
function bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(
line: Feature<LineString> | LineString,
options: {
properties?: P;
@ -70,5 +70,5 @@ function bezier<P extends GeoJsonProperties = GeoJsonProperties>(
return lineString(coords, options.properties);
}
export { bezier };
export default bezier;
export { bezierSpline };
export default bezierSpline;

View File

@ -1,4 +1,4 @@
export interface Point {
interface Point {
x: number;
y: number;
z: number;
@ -30,7 +30,7 @@ export interface Point {
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
export default class Spline {
class Spline {
public duration: number;
public points: Point[];
public sharpness: number;
@ -194,3 +194,6 @@ function B(t: number) {
(1 - t) * (1 - t) * (1 - t),
];
}
export { Spline, Point };
export default Spline;

View File

@ -23,26 +23,30 @@
"curve",
"linestring"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -54,13 +58,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -4,7 +4,7 @@ import path from "path";
import { loadJsonFileSync } from "load-json-file";
import { writeJsonFileSync } from "write-json-file";
import { featureCollection } from "@turf/helpers";
import { bezier as bezierSpline } from "./index";
import { bezierSpline } from "./index";
const directories = {
in: path.join(__dirname, "test", "in") + path.sep,

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts", "lib/spline.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -27,26 +27,30 @@
"clockwise",
"boolean"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -59,12 +63,13 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -26,26 +26,30 @@
"convex",
"boolean"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -58,12 +62,13 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -8,9 +8,9 @@ import {
Point,
Polygon,
} from "geojson";
import calcBbox from "@turf/bbox";
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
import isPointOnLine from "@turf/boolean-point-on-line";
import { bbox as calcBbox } from "@turf/bbox";
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
import { booleanPointOnLine as isPointOnLine } from "@turf/boolean-point-on-line";
import { getGeom } from "@turf/invariant";
/**

View File

@ -26,26 +26,30 @@
"boolean",
"de-9im"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -60,15 +64,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/boolean-point-on-line": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/boolean-point-on-line": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,7 +1,7 @@
import { Feature, Geometry, Polygon, LineString, MultiPoint } from "geojson";
import lineIntersect from "@turf/line-intersect";
import { lineIntersect } from "@turf/line-intersect";
import { polygonToLine } from "@turf/polygon-to-line";
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
import { getGeom } from "@turf/invariant";
import { point } from "@turf/helpers";

View File

@ -26,26 +26,30 @@
"boolean",
"de-9im"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -59,15 +63,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/line-intersect": "^7.0.0-alpha.2",
"@turf/polygon-to-line": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/line-intersect": "workspace:^",
"@turf/polygon-to-line": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,8 +1,8 @@
import { Feature, Geometry, LineString, Point, Polygon } from "geojson";
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
import lineIntersect from "@turf/line-intersect";
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
import { lineIntersect } from "@turf/line-intersect";
import { flattenEach } from "@turf/meta";
import polygonToLine from "@turf/polygon-to-line";
import { polygonToLine } from "@turf/polygon-to-line";
/**
* Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.

View File

@ -26,26 +26,30 @@
"boolean",
"de-9im"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -58,15 +62,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/line-intersect": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/polygon-to-line": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/line-intersect": "workspace:^",
"@turf/meta": "workspace:^",
"@turf/polygon-to-line": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,6 +1,6 @@
import { Feature, Geometry } from "geojson";
import GeojsonEquality from "geojson-equality";
import cleanCoords from "@turf/clean-coords";
import { cleanCoords } from "@turf/clean-coords";
import { getGeom } from "@turf/invariant";
/**

View File

@ -29,26 +29,30 @@
"equal",
"boolean-equal"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -63,13 +67,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/clean-coords": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/clean-coords": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"geojson-equality": "0.1.6",
"tslib": "^2.6.2"
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { Feature, Geometry } from "geojson";
import booleanDisjoint from "@turf/boolean-disjoint";
import { booleanDisjoint } from "@turf/boolean-disjoint";
import { flattenEach } from "@turf/meta";
/**

View File

@ -26,26 +26,30 @@
"boolean",
"de-9im"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -58,13 +62,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/boolean-disjoint": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/boolean-disjoint": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,8 +1,8 @@
import { Feature, Geometry, MultiPoint } from "geojson";
import { segmentEach } from "@turf/meta";
import { getGeom } from "@turf/invariant";
import lineOverlap from "@turf/line-overlap";
import lineIntersect from "@turf/line-intersect";
import { lineOverlap } from "@turf/line-overlap";
import { lineIntersect } from "@turf/line-intersect";
import GeojsonEquality from "geojson-equality";
/**

View File

@ -28,26 +28,30 @@
"overlap",
"boolean-overlap"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -62,15 +66,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/line-intersect": "^7.0.0-alpha.2",
"@turf/line-overlap": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/line-intersect": "workspace:^",
"@turf/line-overlap": "workspace:^",
"@turf/meta": "workspace:^",
"geojson-equality": "0.1.6",
"tslib": "^2.6.2"
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,7 +1,7 @@
import { Feature, Geometry, LineString, Position } from "geojson";
import cleanCoords from "@turf/clean-coords";
import lineSegment from "@turf/line-segment";
import rhumbBearing from "@turf/rhumb-bearing";
import { cleanCoords } from "@turf/clean-coords";
import { lineSegment } from "@turf/line-segment";
import { rhumbBearing } from "@turf/rhumb-bearing";
import { bearingToAzimuth } from "@turf/helpers";
/**

View File

@ -25,26 +25,30 @@
"boolean",
"boolean-parallel"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -56,15 +60,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/clean-coords": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/line-segment": "^7.0.0-alpha.2",
"@turf/rhumb-bearing": "^7.0.0-alpha.2",
"@turf/clean-coords": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/line-segment": "workspace:^",
"@turf/rhumb-bearing": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -24,26 +24,30 @@
"bin",
"gis"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -54,12 +58,13 @@
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"point-in-polygon-hao": "^1.1.0",
"tslib": "^2.6.2"
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -23,26 +23,30 @@
"turf",
"booleanPointOnLine"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -55,13 +59,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,6 +1,6 @@
import { Feature, Geometry, LineString, Point } from "geojson";
import booleanPointOnLine from "@turf/boolean-point-on-line";
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
import { booleanPointOnLine } from "@turf/boolean-point-on-line";
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
import { getGeom } from "@turf/invariant";
/**

View File

@ -27,26 +27,30 @@
"touches",
"boolean-touches"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
@ -62,14 +66,15 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/boolean-point-on-line": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/boolean-point-on-line": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,9 +1,9 @@
import * as helpers from "@turf/helpers";
import booleanWithin from "./index";
import { booleanTouches } from "./index";
const pt = helpers.point([0, 0]);
const line = helpers.lineString([
[0, 0],
[10, 10],
]);
booleanWithin(pt, line);
booleanTouches(pt, line);

View File

@ -1,10 +1,10 @@
import { Feature, Geometry, Position } from "geojson";
import { getGeom } from "@turf/invariant";
import { polygon, lineString } from "@turf/helpers";
import booleanDisjoint from "@turf/boolean-disjoint";
import booleanCrosses from "@turf/boolean-crosses";
import lineIntersect from "@turf/line-intersect";
import isPointOnLine from "@turf/boolean-point-on-line";
import { booleanDisjoint } from "@turf/boolean-disjoint";
import { booleanCrosses } from "@turf/boolean-crosses";
import { lineIntersect } from "@turf/line-intersect";
import { booleanPointOnLine as isPointOnLine } from "@turf/boolean-point-on-line";
/**
* booleanValid checks if the geometry is a valid according to the OGC Simple Feature Specification.

View File

@ -26,26 +26,30 @@
"boolean",
"ogc"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
@ -60,19 +64,20 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/boolean-crosses": "^7.0.0-alpha.2",
"@turf/boolean-disjoint": "^7.0.0-alpha.2",
"@turf/boolean-overlap": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/boolean-point-on-line": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/line-intersect": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/boolean-crosses": "workspace:^",
"@turf/boolean-disjoint": "workspace:^",
"@turf/boolean-overlap": "workspace:^",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/boolean-point-on-line": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/line-intersect": "workspace:^",
"geojson-polygon-self-intersections": "^1.2.1",
"tslib": "^2.6.2"
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -27,26 +27,30 @@
"within",
"boolean-within"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
@ -62,15 +66,16 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.2",
"@turf/boolean-point-on-line": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/boolean-point-in-polygon": "workspace:^",
"@turf/boolean-point-on-line": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import * as helpers from "@turf/helpers";
import booleanWithin from "./index";
import { booleanWithin } from "./index";
const pt = helpers.point([0, 0]);
const line = helpers.lineString([

View File

@ -1,4 +1,4 @@
import center from "@turf/center";
import { center } from "@turf/center";
import jsts from "@turf/jsts";
import { geomEach, featureEach } from "@turf/meta";
import { geoAzimuthalEquidistant } from "d3-geo";

View File

@ -30,17 +30,23 @@
"geojson",
"turf"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "index.d.ts",
"sideEffects": false,
"files": [
"dist",
@ -48,29 +54,29 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/truncate": "workspace:^",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"rollup": "^2.79.1",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/center": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/center": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/jsts": "^2.7.1",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/projection": "^7.0.0-alpha.2",
"@turf/meta": "workspace:^",
"@turf/projection": "workspace:^",
"d3-geo": "1.7.1"
}
}

View File

@ -3,7 +3,7 @@ import test from "tape";
import path from "path";
import { loadJsonFileSync } from "load-json-file";
import { writeJsonFileSync } from "write-json-file";
import truncate from "@turf/truncate";
import { truncate } from "@turf/truncate";
import { featureEach } from "@turf/meta";
import {
featureCollection,

View File

@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.shared.json"
}

View File

@ -9,7 +9,7 @@ import {
geometryCollection,
} from "@turf/helpers";
import { Point, LineString } from "geojson";
import buffer from "./";
import { buffer } from "./index";
// Standard Geometry
const pt = point([100, 0]);

View File

@ -28,34 +28,38 @@
"geo",
"turf"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/center": "^7.0.0-alpha.2",
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/center": "workspace:^",
"@turf/truncate": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
@ -63,14 +67,15 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { lineString } from "@turf/helpers";
import centerMean from "./index";
import { centerMean } from "./index";
const line = lineString([
[0, 0],

View File

@ -1,7 +1,7 @@
import { FeatureCollection, Feature, Point, Position } from "geojson";
import centerMean from "@turf/center-mean";
import distance from "@turf/distance";
import centroid from "@turf/centroid";
import { centerMean } from "@turf/center-mean";
import { distance } from "@turf/distance";
import { centroid } from "@turf/centroid";
import { isNumber, point, isObject, featureCollection } from "@turf/helpers";
import { featureEach } from "@turf/meta";

View File

@ -23,51 +23,56 @@
"turf",
"center-median"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts"
},
"devDependencies": {
"@turf/center": "^7.0.0-alpha.2",
"@turf/center-of-mass": "^7.0.0-alpha.2",
"@turf/random": "^7.0.0-alpha.2",
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/center": "workspace:^",
"@turf/center-of-mass": "workspace:^",
"@turf/random": "workspace:^",
"@turf/truncate": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/center-mean": "^7.0.0-alpha.2",
"@turf/centroid": "^7.0.0-alpha.2",
"@turf/distance": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/center-mean": "workspace:^",
"@turf/centroid": "workspace:^",
"@turf/distance": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -4,7 +4,7 @@ import path from "path";
import { loadJsonFileSync } from "load-json-file";
import { writeJsonFileSync } from "write-json-file";
import { center } from "@turf/center";
import truncate from "@turf/truncate";
import { truncate } from "@turf/truncate";
import { centerMean } from "@turf/center-mean";
import { centerOfMass } from "@turf/center-of-mass";
import { featureCollection, round } from "@turf/helpers";

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,6 +1,6 @@
import { Feature, GeoJsonProperties, Point, Position } from "geojson";
import convex from "@turf/convex";
import centroid from "@turf/centroid";
import { convex } from "@turf/convex";
import { centroid } from "@turf/centroid";
import { point } from "@turf/helpers";
import { getType, getCoord } from "@turf/invariant";
import { coordEach } from "@turf/meta";

View File

@ -20,26 +20,30 @@
"turf",
"gis"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
@ -53,16 +57,17 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/centroid": "^7.0.0-alpha.2",
"@turf/convex": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/centroid": "workspace:^",
"@turf/convex": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { lineString } from "@turf/helpers";
import centerOfMass from "./index";
import { centerOfMass } from "./index";
const line = lineString([
[0, 0],

View File

@ -1,5 +1,5 @@
import { BBox, Feature, GeoJsonProperties, Point } from "geojson";
import bbox from "@turf/bbox";
import { bbox } from "@turf/bbox";
import { point, Id, AllGeoJSON } from "@turf/helpers";
/**

View File

@ -24,34 +24,38 @@
"geo",
"turf"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/bbox-polygon": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/bbox-polygon": "workspace:^",
"@turf/meta": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
@ -59,13 +63,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/bbox": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/bbox": "workspace:^",
"@turf/helpers": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { lineString } from "@turf/helpers";
import center from "./index";
import { center } from "./index";
const line = lineString([
[0, 0],

View File

@ -22,26 +22,30 @@
"geo",
"gis"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
@ -56,13 +60,14 @@
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/meta": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { lineString } from "@turf/helpers";
import centroid from "./index";
import { centroid } from "./index";
const line = lineString([
[0, 0],

View File

@ -1,5 +1,5 @@
import { GeoJsonProperties, Feature, Point, Polygon } from "geojson";
import destination from "@turf/destination";
import { destination } from "@turf/destination";
import { polygon, Units } from "@turf/helpers";
/**
@ -36,8 +36,8 @@ function circle<P extends GeoJsonProperties = GeoJsonProperties>(
const properties: any = options.properties
? options.properties
: !Array.isArray(center) && center.type === "Feature" && center.properties
? center.properties
: {};
? center.properties
: {};
// main
const coordinates = [];

View File

@ -24,26 +24,30 @@
"miles",
"km"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
@ -51,20 +55,21 @@
},
"devDependencies": {
"@mapbox/geojsonhint": "^3.2.0",
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/truncate": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/destination": "^7.0.0-alpha.2",
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/destination": "workspace:^",
"@turf/helpers": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { point } from "@turf/helpers";
import circle from "./index";
import { circle } from "./index";
const center = point([-75.343, 39.984]);
const units = "kilometers";

View File

@ -24,46 +24,51 @@
"gis",
"clean-coords"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/truncate": "^7.0.0-alpha.2",
"@turf/truncate": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/invariant": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"tslib": "^2.6.2"
}
}

View File

@ -1,7 +1,3 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "dist/js"
},
"files": ["index.ts"]
"extends": "../../tsconfig.shared.json"
}

View File

@ -1,5 +1,5 @@
import { multiPoint } from "@turf/helpers";
import cleanCoords from "./index";
import { cleanCoords } from "./index";
// Fixtures
const multiPt = multiPoint([

View File

@ -73,7 +73,7 @@ function cloneFeature(geojson: any) {
* @param {Object} properties GeoJSON Properties
* @returns {Object} cloned Properties
*/
export function cloneProperties(properties: GeoJsonProperties) {
function cloneProperties(properties: GeoJsonProperties) {
const cloned: { [key: string]: any } = {};
if (!properties) {
return cloned;
@ -167,5 +167,5 @@ function deepSlice<C = any[]>(coords: C): C {
});
}
export { clone };
export { clone, cloneProperties };
export default clone;

View File

@ -23,43 +23,48 @@
"turf",
"clone"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"type": "commonjs",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/js/index.d.ts",
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "tsx bench.ts",
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"build": "tsup --config ../../tsup.config.ts",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
},
"devDependencies": {
"@turf/meta": "^7.0.0-alpha.2",
"@turf/meta": "workspace:^",
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
"tape": "^5.7.2",
"tsx": "^3.14.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@turf/helpers": "^7.0.0-alpha.2",
"@turf/helpers": "workspace:^",
"tslib": "^2.6.2"
}
}

Some files were not shown because too many files have changed in this diff Show More