@maplibre/geojson-vt 5.0.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +3 -13
  2. package/dist/clip.d.ts +20 -1
  3. package/dist/clip.d.ts.map +1 -1
  4. package/dist/cluster-tile-index.d.ts +76 -0
  5. package/dist/cluster-tile-index.d.ts.map +1 -0
  6. package/dist/cluster-tile-index.test.d.ts +2 -0
  7. package/dist/cluster-tile-index.test.d.ts.map +1 -0
  8. package/dist/convert.d.ts +10 -2
  9. package/dist/convert.d.ts.map +1 -1
  10. package/dist/deconvert.d.ts +19 -0
  11. package/dist/deconvert.d.ts.map +1 -0
  12. package/dist/deconvert.test.d.ts +2 -0
  13. package/dist/deconvert.test.d.ts.map +1 -0
  14. package/dist/definitions.d.ts +176 -20
  15. package/dist/definitions.d.ts.map +1 -1
  16. package/dist/feature.d.ts +11 -3
  17. package/dist/feature.d.ts.map +1 -1
  18. package/dist/geojson-to-tile.d.ts +35 -0
  19. package/dist/geojson-to-tile.d.ts.map +1 -0
  20. package/dist/geojson-vt-dev.js +1582 -478
  21. package/dist/geojson-vt.js +1 -1
  22. package/dist/geojson-vt.mjs +1250 -473
  23. package/dist/geojson-vt.mjs.map +1 -1
  24. package/dist/geojsonvt.d.ts +76 -0
  25. package/dist/geojsonvt.d.ts.map +1 -0
  26. package/dist/geojsonvt.test.d.ts +2 -0
  27. package/dist/geojsonvt.test.d.ts.map +1 -0
  28. package/dist/index.d.ts +8 -62
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/tile-index.d.ts +51 -0
  31. package/dist/tile-index.d.ts.map +1 -0
  32. package/dist/tile.d.ts +1 -29
  33. package/dist/tile.d.ts.map +1 -1
  34. package/dist/transform.d.ts +1 -18
  35. package/dist/transform.d.ts.map +1 -1
  36. package/package.json +18 -10
  37. package/src/clip.ts +119 -81
  38. package/src/cluster-tile-index.test.ts +205 -0
  39. package/src/cluster-tile-index.ts +513 -0
  40. package/src/convert.ts +97 -75
  41. package/src/deconvert.test.ts +153 -0
  42. package/src/deconvert.ts +92 -0
  43. package/src/definitions.ts +196 -18
  44. package/src/difference.ts +3 -3
  45. package/src/feature.ts +11 -4
  46. package/src/geojson-to-tile.ts +58 -0
  47. package/src/geojsonvt.test.ts +39 -0
  48. package/src/geojsonvt.ts +209 -0
  49. package/src/index.ts +27 -378
  50. package/src/tile-index.ts +310 -0
  51. package/src/tile.ts +92 -103
  52. package/src/transform.ts +41 -39
  53. package/src/wrap.ts +4 -4
@@ -0,0 +1,76 @@
1
+ import { type GeoJSONVTSourceDiff } from './difference';
2
+ import type { ClusterOrPointFeature, GeoJSONVTOptions, GeoJSONVTTile, SuperclusterOptions } from './definitions';
3
+ export declare const defaultOptions: GeoJSONVTOptions;
4
+ /**
5
+ * Main class for creating and managing a vector tile index from GeoJSON data.
6
+ */
7
+ export declare class GeoJSONVT {
8
+ /**
9
+ * @internal
10
+ * This is for the tests
11
+ */
12
+ get tiles(): any;
13
+ /**
14
+ * @internal
15
+ * This is for the tests
16
+ */
17
+ get stats(): any;
18
+ /**
19
+ * @internal
20
+ * This is for the tests
21
+ */
22
+ get total(): any;
23
+ private options;
24
+ private source?;
25
+ private tileIndex;
26
+ constructor(data: GeoJSON.GeoJSON, options?: GeoJSONVTOptions);
27
+ private initializeIndex;
28
+ /**
29
+ * Given z, x, and y tile coordinates, returns the corresponding tile with geometries in tile coordinates, much like MVT data is stored.
30
+ * @param z - tile zoom level
31
+ * @param x - tile x coordinate
32
+ * @param y - tile y coordinate
33
+ * @returns the transformed tile or null if not found
34
+ */
35
+ getTile(z: number | string, x: number | string, y: number | string): GeoJSONVTTile | null;
36
+ /**
37
+ * Updates the source data feature set using a {@link GeoJSONVTSourceDiff}
38
+ * @param diff - the source diff object
39
+ */
40
+ updateData(diff: GeoJSONVTSourceDiff, filter?: (feature: GeoJSON.Feature) => boolean): void;
41
+ /**
42
+ * Filter an update using a predicate function. Returns the affected and updated source features.
43
+ */
44
+ private filterUpdate;
45
+ /**
46
+ * Returns source data as GeoJSON - only available when `updateable` option is set to true.
47
+ */
48
+ getData(): GeoJSON.GeoJSON;
49
+ /**
50
+ * Update supercluster options and regenerate the index.
51
+ * @param cluster - whether to enable clustering
52
+ * @param clusterOptions - {@link SuperclusterOptions}
53
+ */
54
+ updateClusterOptions(cluster: boolean, clusterOptions: SuperclusterOptions): void;
55
+ /**
56
+ * Returns the zoom level at which a cluster expands into multiple children.
57
+ * @param clusterId - The target cluster id.
58
+ * @returns the expansion zoom or null in case of non-clustered source
59
+ */
60
+ getClusterExpansionZoom(clusterId: number): number | null;
61
+ /**
62
+ * Returns the immediate children (clusters or points) of a cluster as GeoJSON.
63
+ * @param clusterId - The target cluster id.
64
+ * @returns the immediate children or null in case of non-clustered source
65
+ */
66
+ getClusterChildren(clusterId: number): ClusterOrPointFeature[] | null;
67
+ /**
68
+ * Returns leaf point features under a cluster, paginated by `limit` and `offset`.
69
+ * @param clusterId - The target cluster id.
70
+ * @param limit - Maximum number of points to return (defaults to `10`).
71
+ * @param offset - Number of points to skip before collecting results (defaults to `0`).
72
+ * @returns leaf point features under a cluster or null in case of non-clustered source
73
+ */
74
+ getClusterLeaves(clusterId: number, limit: number, offset: number): GeoJSON.Feature<GeoJSON.Point>[] | null;
75
+ }
76
+ //# sourceMappingURL=geojsonvt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojsonvt.d.ts","sourceRoot":"","sources":["../src/geojsonvt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAGvE,OAAO,KAAK,EAAC,qBAAqB,EAAgD,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAE7J,eAAO,MAAM,cAAc,EAAE,gBAc5B,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;IAElB;;;OAGG;IACH,IAAW,KAAK,QAGf;IACD;;;O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""}
package/dist/index.d.ts CHANGED
@@ -1,63 +1,9 @@
1
- import { type GeoJSONVTFeature, type GeoJSONVTFeatureNonPoint, type GeoJSONVTFeaturePoint, type GeoJSONVTTile } from './transform';
2
- import { type GeoJSONVTInternalTile, type GeoJSONVTInternalTileFeature, type GeoJSONVTInternalTileFeaturePoint, type GeoJSONVTInternalTileFeaturNonPoint } from './tile';
3
- import { type GeoJSONVTFeatureDiff, type GeoJSONVTSourceDiff } from './difference';
4
- import type { GeoJSONVTInternalFeature, GeoJSONVTOptions, GeometryType, GeometryTypeMap, PartialGeoJSONVTFeature, StartEndSizeArray } from './definitions';
5
- /**
6
- * Main class for creating and managing a vector tile index from GeoJSON data.
7
- */
8
- declare class GeoJSONVT {
9
- private options;
10
- /** @internal */
11
- tiles: {
12
- [key: string]: GeoJSONVTInternalTile;
13
- };
14
- private tileCoords;
15
- /** @internal */
16
- stats: {
17
- [key: string]: number;
18
- };
19
- /** @internal */
20
- total: number;
21
- private source?;
22
- constructor(data: GeoJSON.GeoJSON, options: GeoJSONVTOptions);
23
- /**
24
- * splits features from a parent tile to sub-tiles.
25
- * z, x, and y are the coordinates of the parent tile
26
- * cz, cx, and cy are the coordinates of the target tile
27
- *
28
- * If no target tile is specified, splitting stops when we reach the maximum
29
- * zoom or the number of points is low as specified in the options.
30
- * @internal
31
- * @param features - features to split
32
- * @param z - tile zoom level
33
- * @param x - tile x coordinate
34
- * @param y - tile y coordinate
35
- * @param cz - target tile zoom level
36
- * @param cx - target tile x coordinate
37
- * @param cy - target tile y coordinate
38
- */
39
- splitTile(features: GeoJSONVTInternalFeature[], z: number, x: number, y: number, cz?: number, cx?: number, cy?: number): void;
40
- /**
41
- * Given z, x, and y tile coordinates, returns the corresponding tile with geometries in tile coordinates, much like MVT data is stored.
42
- * @param z - tile zoom level
43
- * @param x - tile x coordinate
44
- * @param y - tile y coordinate
45
- * @returns the transformed tile or null if not found
46
- */
47
- getTile(z: number | string, x: number | string, y: number | string): GeoJSONVTTile | null;
48
- /**
49
- * Invalidates (removes) tiles affected by the provided features
50
- * @internal
51
- * @param features
52
- */
53
- invalidateTiles(features: GeoJSONVTInternalFeature[]): void;
54
- /**
55
- * Updates the tile index by adding and/or removing geojson features
56
- * invalidates tiles that are affected by the update for regeneration on next getTile call.
57
- * @param diff - the source diff object
58
- */
59
- updateData(diff: GeoJSONVTSourceDiff): void;
60
- }
61
- export default function geojsonvt(data: GeoJSON.GeoJSON, options?: GeoJSONVTOptions): GeoJSONVT;
62
- export type { GeoJSONVTInternalFeature, GeoJSONVTOptions, GeoJSONVTInternalTile, GeoJSONVTInternalTileFeature, GeometryType, PartialGeoJSONVTFeature, GeoJSONVT, GeometryTypeMap, StartEndSizeArray, GeoJSONVTTile, GeoJSONVTFeature, GeoJSONVTSourceDiff, GeoJSONVTFeatureDiff, GeoJSONVTFeaturePoint, GeoJSONVTFeatureNonPoint, GeoJSONVTInternalTileFeaturePoint, GeoJSONVTInternalTileFeaturNonPoint };
1
+ import type { GeoJSONVTFeatureDiff, GeoJSONVTSourceDiff } from './difference';
2
+ import type { GeoJSONVTInternalFeature, GeoJSONVTInternalLineStringFeature, GeoJSONVTInternalMultiLineStringFeature, GeoJSONVTInternalMultiPointFeature, GeoJSONVTInternalMultiPolygonFeature, GeoJSONVTInternalPointFeature, GeoJSONVTInternalPolygonFeature, GeoJSONVTOptions, GeoJSONToTileOptions, PartialGeoJSONVTFeature, StartEndSizeArray, ClusterProperties, ClusterFeature, ClusterOrPointFeature, GeoJSONVTTile, GeoJSONVTFeature, GeoJSONVTFeaturePoint, GeoJSONVTFeatureNonPoint, GeoJSONVTInternalTileFeaturePoint, GeoJSONVTInternalTileFeatureNonPoint, GeoJSONVTInternalTile, GeoJSONVTInternalTileFeature, GeoJSONVTTileIndex, SuperclusterOptions } from './definitions';
3
+ import type { KDBushWithData } from './cluster-tile-index';
4
+ import { GeoJSONVT } from './geojsonvt';
5
+ import { ClusterTileIndex } from './cluster-tile-index';
6
+ import { geoJSONToTile } from './geojson-to-tile';
7
+ export { GeoJSONVT, ClusterTileIndex as Supercluster, geoJSONToTile };
8
+ export type { GeoJSONVTInternalFeature, GeoJSONVTOptions, GeoJSONToTileOptions, GeoJSONVTInternalTile, GeoJSONVTInternalTileFeature, PartialGeoJSONVTFeature, StartEndSizeArray, GeoJSONVTTile, GeoJSONVTFeature, GeoJSONVTSourceDiff, GeoJSONVTFeatureDiff, GeoJSONVTFeaturePoint, GeoJSONVTFeatureNonPoint, GeoJSONVTInternalTileFeaturePoint, GeoJSONVTInternalTileFeatureNonPoint, GeoJSONVTInternalPointFeature, GeoJSONVTInternalMultiPointFeature, GeoJSONVTInternalLineStringFeature, GeoJSONVTInternalMultiLineStringFeature, GeoJSONVTInternalPolygonFeature, GeoJSONVTInternalMultiPolygonFeature, SuperclusterOptions, ClusterProperties, ClusterFeature, ClusterOrPointFeature, KDBushWithData, GeoJSONVTTileIndex };
63
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAa,KAAK,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,KAAK,mCAAmC,EAAC,MAAM,QAAQ,CAAC;AACnL,OAAO,EAAkB,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAClG,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAgB3J;;GAEG;AACH,cAAM,SAAS;IACX,OAAO,CAAC,OAAO,CAAmB;IAClC,gBAAgB;IACT,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,G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ptions, ClusterOrPointFeature, GeoJSONVTTileIndex, GeoJSONVTInternalTile, GeoJSONVTTile } from "./definitions";
2
+ export declare class TileIndex implements GeoJSONVTTileIndex {
3
+ private options;
4
+ private tileCoords;
5
+ /** @internal */
6
+ tiles: {
7
+ [key: string]: GeoJSONVTInternalTile;
8
+ };
9
+ /** @internal */
10
+ stats: {
11
+ [key: string]: number;
12
+ };
13
+ /** @internal */
14
+ total: number;
15
+ constructor(options: GeoJSONVTOptions);
16
+ initialize(features: GeoJSONVTInternalFeature[]): void;
17
+ /** {@inheritdoc} */
18
+ updateIndex(source: GeoJSONVTInternalFeature[], affected: GeoJSONVTInternalFeature[], options: GeoJSONVTOptions): void;
19
+ /** {@inheritdoc} */
20
+ getClusterExpansionZoom(_clusterId: number): number | null;
21
+ /** {@inheritdoc} */
22
+ getChildren(_clusterId: number): ClusterOrPointFeature[] | null;
23
+ /** {@inheritdoc} */
24
+ getLeaves(_clusterId: number, _limit?: number, _offset?: number): GeoJSON.Feature<GeoJSON.Point>[] | null;
25
+ /** {@inheritdoc} */
26
+ getTile(z: number, x: number, y: number): GeoJSONVTTile | null;
27
+ /**
28
+ * splits features from a parent tile to sub-tiles.
29
+ * z, x, and y are the coordinates of the parent tile
30
+ * cz, cx, and cy are the coordinates of the target tile
31
+ *
32
+ * If no target tile is specified, splitting stops when we reach the maximum
33
+ * zoom or the number of points is low as specified in the options.
34
+ * @internal
35
+ * @param features - features to split
36
+ * @param z - tile zoom level
37
+ * @param x - tile x coordinate
38
+ * @param y - tile y coordinate
39
+ * @param cz - target tile zoom level
40
+ * @param cx - target tile x coordinate
41
+ * @param cy - target tile y coordinate
42
+ */
43
+ private splitTile;
44
+ /**
45
+ * Invalidates (removes) tiles affected by the provided features
46
+ * @internal
47
+ * @param features
48
+ */
49
+ private invalidateTiles;
50
+ }
51
+ //# sourceMappingURL=tile-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-index.d.ts","sourceRoot":"","sources":["../src/tile-index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IG;IACH,OAAO,CAAC,eAAe;CAuE1B"}
package/dist/tile.d.ts CHANGED
@@ -1,32 +1,4 @@
1
- import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from "./definitions";
2
- export type GeoJSONVTInternalTileFeaturePoint = {
3
- id?: number | string | undefined;
4
- type: 1;
5
- tags: GeoJSON.GeoJsonProperties | null;
6
- geometry: number[];
7
- };
8
- export type GeoJSONVTInternalTileFeaturNonPoint = {
9
- id?: number | string | undefined;
10
- type: 2 | 3;
11
- tags: GeoJSON.GeoJsonProperties | null;
12
- geometry: number[][];
13
- };
14
- export type GeoJSONVTInternalTileFeature = GeoJSONVTInternalTileFeaturePoint | GeoJSONVTInternalTileFeaturNonPoint;
15
- export type GeoJSONVTInternalTile = {
16
- features: GeoJSONVTInternalTileFeature[];
17
- numPoints: number;
18
- numSimplified: number;
19
- numFeatures: number;
20
- x: number;
21
- y: number;
22
- z: number;
23
- transformed: boolean;
24
- minX: number;
25
- minY: number;
26
- maxX: number;
27
- maxY: number;
28
- source: GeoJSONVTInternalFeature[] | null;
29
- };
1
+ import type { GeoJSONVTInternalFeature, GeoJSONVTInternalTile, GeoJSONVTOptions } from "./definitions";
30
2
  /**
31
3
  * Creates a tile object from the given features
32
4
  * @param features - the features to include in the tile
@@ -1 +1 @@
1
- {"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../src/tile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAEnG,MAAM,MAAM,iCAAiC,GAAG;IAC5C,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAC9C,EAAE,CAAC,EAAG,MAAM,G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AG,qBAAqB,CAwBpJ"}
@@ -1,21 +1,4 @@
1
- import type { GeoJSONVTInternalTile } from "./tile";
2
- export type GeoJSONVTFeaturePoint = {
3
- id?: number | string | undefined;
4
- type: 1;
5
- tags: GeoJSON.GeoJsonProperties | null;
6
- geometry: [number, number][];
7
- };
8
- export type GeoJSONVTFeatureNonPoint = {
9
- id?: number | string | undefined;
10
- type: 2 | 3;
11
- tags: GeoJSON.GeoJsonProperties | null;
12
- geometry: [number, number][][];
13
- };
14
- export type GeoJSONVTFeature = GeoJSONVTFeaturePoint | GeoJSONVTFeatureNonPoint;
15
- export type GeoJSONVTTile = GeoJSONVTInternalTile & {
16
- transformed: true;
17
- features: GeoJSONVTFeature[];
18
- };
1
+ import type { GeoJSONVTInternalTile, GeoJSONVTTile } from "./definitions";
19
2
  /**
20
3
  * Transforms the coordinates of each feature in the given tile from
21
4
  * mercator-projected space into (extent x extent) tile space.
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAChC,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,wBAAwB,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG;IAChD,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAgCxF"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmD,qBAAqB,EAA2E,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpM;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAmBxF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maplibre/geojson-vt",
3
- "version": "5.0.4",
3
+ "version": "6.0.0",
4
4
  "description": "Slice GeoJSON data into vector tiles efficiently",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,28 +24,33 @@
24
24
  "jsdelivr": "dist/geojson-vt.js",
25
25
  "unpkg": "dist/geojson-vt.js",
26
26
  "devDependencies": {
27
- "@eslint/js": "^9.39.2",
27
+ "@eslint/js": "^10.0.1",
28
+ "@rollup/plugin-node-resolve": "^16.0.3",
28
29
  "@rollup/plugin-terser": "^0.4.4",
29
30
  "@rollup/plugin-typescript": "^12.3.0",
31
+ "@types/benchmark": "^2.1.5",
30
32
  "@types/geojson": "^7946.0.16",
31
- "@types/node": "^25.0.9",
32
- "@vitest/coverage-v8": "^4.0.17",
33
+ "@types/node": "^25.3.0",
34
+ "@vitest/coverage-v8": "^4.0.18",
33
35
  "benchmark": "^2.1.4",
34
- "eslint": "^9.39.2",
35
- "rollup": "^4.55.2",
36
+ "eslint": "^10.0.2",
37
+ "rollup": "^4.59.0",
36
38
  "tslib": "^2.8.1",
37
- "typedoc": "^0.28.16",
39
+ "tsx": "^4.21.0",
40
+ "typedoc": "^0.28.17",
38
41
  "typescript": "^5.9.3",
39
- "typescript-eslint": "^8.53.1",
42
+ "typescript-eslint": "^8.56.1",
40
43
  "vitest": "^4.0.17"
41
44
  },
42
45
  "license": "ISC",
43
46
  "scripts": {
44
- "lint": "eslint **/*.ts",
47
+ "lint": "eslint",
45
48
  "test": "vitest",
49
+ "coverage": "vitest run --coverage",
46
50
  "build": "rollup -c && tsc -p tsconfig.declaration.json",
47
51
  "watch": "rollup -cw",
48
- "bench": "node bench/benchmark.js",
52
+ "start": "npm run watch",
53
+ "bench": "tsx bench/benchmark.ts",
49
54
  "docs": "typedoc && mkdir -p docs/debug && cp -r debug/* docs/debug && find docs/debug -name '*.html' -exec sed -i 's|../dist/geojson-vt-dev.js|https://unpkg.com/@maplibre/geojson-vt@latest/dist/geojson-vt.js|g' {} +",
50
55
  "prepublishOnly": "npm run test && npm run build"
51
56
  },
@@ -56,5 +61,8 @@
56
61
  "repository": {
57
62
  "type": "git",
58
63
  "url": "https://github.com/maplibre/geojson-vt"
64
+ },
65
+ "dependencies": {
66
+ "kdbush": "^4.0.2"
59
67
  }
60
68
  }