@duoquote/polytini 0.1.0 → 0.1.1

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 (68) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +120 -120
  3. package/dist/types/cli.d.cts +2 -2
  4. package/dist/types/deckgl.d.cts +72 -60
  5. package/dist/types/flexible.d.cts +92 -80
  6. package/dist/types/geojson.jsr.d.cts +111 -0
  7. package/dist/types/google.d.cts +48 -48
  8. package/dist/types/google.jsr.d.cts +72 -60
  9. package/dist/types/index.d.cts +109 -87
  10. package/dist/types/leaflet-auto.d.cts +4 -4
  11. package/dist/types/leaflet-auto.jsr.d.cts +2 -2
  12. package/dist/types/leaflet.d.cts +39 -39
  13. package/dist/types/leaflet.jsr.d.cts +15 -13
  14. package/dist/types/mapbox.d.cts +50 -50
  15. package/dist/types/mapbox.jsr.d.cts +5 -0
  16. package/dist/types/maplibre.d.cts +54 -54
  17. package/dist/types/maplibre.jsr.d.cts +92 -0
  18. package/dist/types/openlayers.d.cts +23 -23
  19. package/dist/types/openlayers.jsr.d.cts +42 -0
  20. package/dist/types/presets.d.cts +70 -66
  21. package/dist/types/turf.d.cts +33 -33
  22. package/dist/types/turf.jsr.d.cts +46 -0
  23. package/dist/types/wasm.d.cts +42 -33
  24. package/package.json +200 -200
  25. package/src/browser.js +15 -15
  26. package/src/bun.js +4 -4
  27. package/src/cli-lib.js +160 -160
  28. package/src/cli.js +7 -7
  29. package/src/core.js +268 -268
  30. package/src/deckgl.js +176 -176
  31. package/src/deno.js +12 -12
  32. package/src/error.js +15 -15
  33. package/src/fast.js +179 -179
  34. package/src/flexible.js +283 -283
  35. package/src/google.js +70 -70
  36. package/src/leaflet-auto.js +11 -11
  37. package/src/leaflet.js +44 -44
  38. package/src/mapbox.js +10 -10
  39. package/src/maplibre.js +57 -57
  40. package/src/node.js +17 -17
  41. package/src/openlayers.js +172 -172
  42. package/src/presets.js +242 -242
  43. package/src/text.js +111 -111
  44. package/src/turf.js +80 -80
  45. package/src/wasm-bytes.js +2 -2
  46. package/src/wasm.js +235 -235
  47. package/src/web.js +9 -9
  48. package/types/cli.d.ts +2 -2
  49. package/types/deckgl.d.ts +72 -60
  50. package/types/flexible.d.ts +92 -80
  51. package/types/geojson.jsr.d.ts +111 -0
  52. package/types/google.d.ts +48 -48
  53. package/types/google.jsr.d.ts +72 -60
  54. package/types/index.d.ts +109 -87
  55. package/types/leaflet-auto.d.ts +4 -4
  56. package/types/leaflet-auto.jsr.d.ts +2 -2
  57. package/types/leaflet.d.ts +39 -39
  58. package/types/leaflet.jsr.d.ts +15 -13
  59. package/types/mapbox.d.ts +50 -50
  60. package/types/mapbox.jsr.d.ts +5 -0
  61. package/types/maplibre.d.ts +54 -54
  62. package/types/maplibre.jsr.d.ts +92 -0
  63. package/types/openlayers.d.ts +23 -23
  64. package/types/openlayers.jsr.d.ts +42 -0
  65. package/types/presets.d.ts +70 -66
  66. package/types/turf.d.ts +33 -33
  67. package/types/turf.jsr.d.ts +46 -0
  68. package/types/wasm.d.ts +42 -33
@@ -1,33 +1,33 @@
1
- // Types for @duoquote/polytini/turf, using Turf's and GeoJSON's own types.
2
- import type { Feature, FeatureCollection, LineString, Polygon, GeoJsonProperties } from 'geojson';
3
- import type { AllGeoJSON, Id } from '@turf/helpers';
4
- import type { Options } from './index.d.ts';
5
-
6
- export interface FeatureOptions<P = GeoJsonProperties> extends Options {
7
- /** Feature properties. Default {}. */
8
- properties?: P;
9
- /** Feature id. */
10
- id?: Id;
11
- /** Add a [west, south, east, north] bbox. Default false. */
12
- bbox?: boolean;
13
- }
14
-
15
- export interface CollectionOptions<P = GeoJsonProperties> extends Options {
16
- /** Shared properties, or one object per line. */
17
- properties?: P | P[];
18
- /** One id per line, or the same for all. */
19
- id?: Id | Id[];
20
- bbox?: boolean;
21
- }
22
-
23
- /** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
24
- export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
25
-
26
- /** A FeatureCollection<LineString>, one Feature per string. */
27
- export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
28
-
29
- /** A Feature<Polygon> from encoded rings: outer first, then holes. */
30
- export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
31
-
32
- /** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
33
- export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
1
+ // Types for @duoquote/polytini/turf, using Turf's and GeoJSON's own types.
2
+ import type { Feature, FeatureCollection, LineString, Polygon, GeoJsonProperties } from 'geojson';
3
+ import type { AllGeoJSON, Id } from '@turf/helpers';
4
+ import type { Options } from './index.d.ts';
5
+
6
+ export interface FeatureOptions<P = GeoJsonProperties> extends Options {
7
+ /** Feature properties. Default {}. */
8
+ properties?: P;
9
+ /** Feature id. */
10
+ id?: Id;
11
+ /** Add a [west, south, east, north] bbox. Default false. */
12
+ bbox?: boolean;
13
+ }
14
+
15
+ export interface CollectionOptions<P = GeoJsonProperties> extends Options {
16
+ /** Shared properties, or one object per line. */
17
+ properties?: P | P[];
18
+ /** One id per line, or the same for all. */
19
+ id?: Id | Id[];
20
+ bbox?: boolean;
21
+ }
22
+
23
+ /** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
24
+ export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
25
+
26
+ /** A FeatureCollection<LineString>, one Feature per string. */
27
+ export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
28
+
29
+ /** A Feature<Polygon> from encoded rings: outer first, then holes. */
30
+ export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
31
+
32
+ /** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
33
+ export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
@@ -0,0 +1,46 @@
1
+ // JSR copy of turf.d.ts. JSR builds its docs without node_modules, so the
2
+ // GeoJSON types come from geojson.jsr.d.ts and Turf's Id and AllGeoJSON are
3
+ // written out here. They have the same shapes as @types/geojson's and
4
+ // @turf/helpers', which the npm package's turf.d.ts uses.
5
+ import type { Options } from './index.d.ts';
6
+ import type { Feature, FeatureCollection, Geometry, LineString, Polygon, GeoJsonProperties } from './geojson.jsr.d.ts';
7
+
8
+ export type { Feature, FeatureCollection, Geometry, GeometryCollection, Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, Position, BBox, GeoJsonProperties } from './geojson.jsr.d.ts';
9
+
10
+ /** A feature id, like Turf's Id. */
11
+ export type Id = string | number;
12
+
13
+ /** Any GeoJSON object, like Turf's AllGeoJSON. */
14
+ export type AllGeoJSON = Feature<Geometry | null> | FeatureCollection<Geometry | null> | Geometry;
15
+
16
+ /** Options for toFeature and toPolygonFeature. */
17
+ export interface FeatureOptions<P = GeoJsonProperties> extends Options {
18
+ /** Feature properties. Default {}. */
19
+ properties?: P;
20
+ /** Feature id. */
21
+ id?: Id;
22
+ /** Add a [west, south, east, north] bbox. Default false. */
23
+ bbox?: boolean;
24
+ }
25
+
26
+ /** Options for toFeatureCollection. */
27
+ export interface CollectionOptions<P = GeoJsonProperties> extends Options {
28
+ /** Shared properties, or one object per line. */
29
+ properties?: P | P[];
30
+ /** One id per line, or the same for all. */
31
+ id?: Id | Id[];
32
+ /** Add a bbox to each feature. Default false. */
33
+ bbox?: boolean;
34
+ }
35
+
36
+ /** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
37
+ export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
38
+
39
+ /** A FeatureCollection<LineString>, one Feature per string. */
40
+ export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
41
+
42
+ /** A Feature<Polygon> from encoded rings: outer first, then holes. */
43
+ export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
44
+
45
+ /** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
46
+ export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
@@ -1,33 +1,42 @@
1
- // The /wasm entry: the same API as the main entry, after init.
2
- import type * as P from './index.d.ts';
3
-
4
- export type { Point, LatLngLike, Options, OptionsArg, ErrorCode, LineString, LineStringFeature } from './index.d.ts';
5
- export declare const encode: typeof P.encode;
6
- export declare const decode: typeof P.decode;
7
- export declare const encodeFlat: typeof P.encodeFlat;
8
- export declare const decodeFlat: typeof P.decodeFlat;
9
- export declare const decodeLatLng: typeof P.decodeLatLng;
10
- export declare const toGeoJSON: typeof P.toGeoJSON;
11
- export declare const fromGeoJSON: typeof P.fromGeoJSON;
12
- export declare const PolylineError: typeof P.PolylineError;
13
- export type PolylineError = P.PolylineError;
14
-
15
- /** Compiles and instantiates the WASM module. Call once before anything else; repeat calls are free. */
16
- export function init(): Promise<void>;
17
-
18
- /** The same, synchronously. Fine here because the module is under 1 KB. */
19
- export function initSync(): void;
20
-
21
- /** Many lines decoded in one call: all points in one array, plus where each line starts. */
22
- export interface ManyLines {
23
- /** lat, lng pairs (lng, lat with order 'lnglat') of every line, back to back. */
24
- coords: Float64Array;
25
- /** The first point index of each line, then the total point count (length + 1 entries), as deck.gl's binary paths expect. */
26
- starts: Uint32Array;
27
- }
28
-
29
- /** Decodes many lines in one WASM call. Strict mode throws on the first bad line. */
30
- export function decodeMany(lines: readonly string[], options?: P.OptionsArg): ManyLines;
31
-
32
- /** Encodes many lines in one WASM call: arrays of points, or the { coords, starts } shape decodeMany returns. */
33
- export function encodeMany(lines: readonly (readonly P.Point[])[] | ManyLines, options?: P.OptionsArg): string[];
1
+ // The /wasm entry: the same API as the main entry, after init.
2
+ import type * as P from './index.d.ts';
3
+
4
+ export type { Point, LatLngLike, Options, OptionsArg, ErrorCode, LineString, LineStringFeature } from './index.d.ts';
5
+ /** The main entry's encode. */
6
+ export declare const encode: typeof P.encode;
7
+ /** The main entry's decode. */
8
+ export declare const decode: typeof P.decode;
9
+ /** The main entry's encodeFlat. */
10
+ export declare const encodeFlat: typeof P.encodeFlat;
11
+ /** The main entry's decodeFlat. */
12
+ export declare const decodeFlat: typeof P.decodeFlat;
13
+ /** The main entry's decodeLatLng. */
14
+ export declare const decodeLatLng: typeof P.decodeLatLng;
15
+ /** The main entry's toGeoJSON. */
16
+ export declare const toGeoJSON: typeof P.toGeoJSON;
17
+ /** The main entry's fromGeoJSON. */
18
+ export declare const fromGeoJSON: typeof P.fromGeoJSON;
19
+ /** The main entry's PolylineError. */
20
+ export declare const PolylineError: typeof P.PolylineError;
21
+ /** The main entry's PolylineError type. */
22
+ export type PolylineError = P.PolylineError;
23
+
24
+ /** Compiles and instantiates the WASM module. Call once before anything else; repeat calls are free. */
25
+ export function init(): Promise<void>;
26
+
27
+ /** The same, synchronously. Fine here because the module is under 1 KB. */
28
+ export function initSync(): void;
29
+
30
+ /** Many lines decoded in one call: all points in one array, plus where each line starts. */
31
+ export interface ManyLines {
32
+ /** lat, lng pairs (lng, lat with order 'lnglat') of every line, back to back. */
33
+ coords: Float64Array;
34
+ /** The first point index of each line, then the total point count (length + 1 entries), as deck.gl's binary paths expect. */
35
+ starts: Uint32Array;
36
+ }
37
+
38
+ /** Decodes many lines in one WASM call. Strict mode throws on the first bad line. */
39
+ export function decodeMany(lines: readonly string[], options?: P.OptionsArg): ManyLines;
40
+
41
+ /** Encodes many lines in one WASM call: arrays of points, or the { coords, starts } shape decodeMany returns. */
42
+ export function encodeMany(lines: readonly (readonly P.Point[])[] | ManyLines, options?: P.OptionsArg): string[];
package/package.json CHANGED
@@ -1,200 +1,200 @@
1
- {
2
- "name": "@duoquote/polytini",
3
- "version": "0.1.0",
4
- "description": "Encode and decode Google encoded polylines. Small, strict by default, with fast paths for Node, Bun and Deno.",
5
- "keywords": [
6
- "polyline",
7
- "encoded polyline",
8
- "google maps",
9
- "geojson",
10
- "osrm",
11
- "valhalla",
12
- "leaflet",
13
- "turf"
14
- ],
15
- "license": "MIT",
16
- "author": "Güven Değirmenci",
17
- "homepage": "https://github.com/Duoquote/polytini#readme",
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/Duoquote/polytini.git"
21
- },
22
- "bugs": "https://github.com/Duoquote/polytini/issues",
23
- "type": "module",
24
- "sideEffects": [
25
- "./src/leaflet-auto.js",
26
- "./dist/leaflet-auto.cjs"
27
- ],
28
- "exports": {
29
- ".": {
30
- "browser": {
31
- "types": "./types/index.d.ts",
32
- "default": "./src/browser.js"
33
- },
34
- "require": {
35
- "types": "./dist/types/index.d.cts",
36
- "default": "./dist/node.cjs"
37
- },
38
- "types": "./types/index.d.ts",
39
- "bun": "./src/bun.js",
40
- "deno": "./src/deno.js",
41
- "node": "./src/node.js",
42
- "default": "./src/web.js"
43
- },
44
- "./web": {
45
- "require": {
46
- "types": "./dist/types/index.d.cts",
47
- "default": "./dist/web.cjs"
48
- },
49
- "types": "./types/index.d.ts",
50
- "default": "./src/web.js"
51
- },
52
- "./node": {
53
- "require": {
54
- "types": "./dist/types/index.d.cts",
55
- "default": "./dist/node.cjs"
56
- },
57
- "types": "./types/index.d.ts",
58
- "default": "./src/node.js"
59
- },
60
- "./browser": {
61
- "types": "./types/index.d.ts",
62
- "default": "./src/browser.js"
63
- },
64
- "./wasm": {
65
- "types": "./types/wasm.d.ts",
66
- "default": "./src/wasm.js"
67
- },
68
- "./turf": {
69
- "require": {
70
- "types": "./dist/types/turf.d.cts",
71
- "default": "./dist/turf.cjs"
72
- },
73
- "types": "./types/turf.d.ts",
74
- "default": "./src/turf.js"
75
- },
76
- "./leaflet": {
77
- "require": {
78
- "types": "./dist/types/leaflet.d.cts",
79
- "default": "./dist/leaflet.cjs"
80
- },
81
- "types": "./types/leaflet.d.ts",
82
- "default": "./src/leaflet.js"
83
- },
84
- "./presets": {
85
- "require": {
86
- "types": "./dist/types/presets.d.cts",
87
- "default": "./dist/presets.cjs"
88
- },
89
- "types": "./types/presets.d.ts",
90
- "default": "./src/presets.js"
91
- },
92
- "./flexible": {
93
- "require": {
94
- "types": "./dist/types/flexible.d.cts",
95
- "default": "./dist/flexible.cjs"
96
- },
97
- "types": "./types/flexible.d.ts",
98
- "default": "./src/flexible.js"
99
- },
100
- "./google": {
101
- "require": {
102
- "types": "./dist/types/google.d.cts",
103
- "default": "./dist/google.cjs"
104
- },
105
- "types": "./types/google.d.ts",
106
- "default": "./src/google.js"
107
- },
108
- "./maplibre": {
109
- "require": {
110
- "types": "./dist/types/maplibre.d.cts",
111
- "default": "./dist/maplibre.cjs"
112
- },
113
- "types": "./types/maplibre.d.ts",
114
- "default": "./src/maplibre.js"
115
- },
116
- "./mapbox": {
117
- "require": {
118
- "types": "./dist/types/mapbox.d.cts",
119
- "default": "./dist/mapbox.cjs"
120
- },
121
- "types": "./types/mapbox.d.ts",
122
- "default": "./src/mapbox.js"
123
- },
124
- "./deckgl": {
125
- "require": {
126
- "types": "./dist/types/deckgl.d.cts",
127
- "default": "./dist/deckgl.cjs"
128
- },
129
- "types": "./types/deckgl.d.ts",
130
- "default": "./src/deckgl.js"
131
- },
132
- "./leaflet/auto": {
133
- "require": {
134
- "types": "./dist/types/leaflet-auto.d.cts",
135
- "default": "./dist/leaflet-auto.cjs"
136
- },
137
- "types": "./types/leaflet-auto.d.ts",
138
- "default": "./src/leaflet-auto.js"
139
- },
140
- "./openlayers": {
141
- "types": "./types/openlayers.d.ts",
142
- "default": "./src/openlayers.js"
143
- },
144
- "./package.json": "./package.json"
145
- },
146
- "types": "./types/index.d.ts",
147
- "main": "./dist/node.cjs",
148
- "bin": {
149
- "polytini": "src/cli.js"
150
- },
151
- "files": [
152
- "src",
153
- "types",
154
- "dist",
155
- "wasm/polytini.wasm"
156
- ],
157
- "engines": {
158
- "node": ">=22"
159
- },
160
- "publishConfig": {
161
- "access": "public"
162
- },
163
- "scripts": {
164
- "build": "node scripts/build.js",
165
- "build:wasm": "node scripts/build-wasm.js",
166
- "prepack": "node scripts/build.js",
167
- "test": "node test/run.js",
168
- "test:bun": "bun test/run.js",
169
- "test:deno": "deno run --allow-read --allow-env --allow-run --allow-write test/run.js",
170
- "test:browser": "node test/browser.js",
171
- "size": "node scripts/size.js",
172
- "smoke": "node test/smoke.js",
173
- "check:deps": "node scripts/check-deps.js"
174
- },
175
- "devDependencies": {
176
- "@deck.gl/core": "^9.4.2",
177
- "@deck.gl/geo-layers": "^9.4.2",
178
- "@deck.gl/layers": "^9.4.2",
179
- "@here/flexpolyline": "^0.1.0",
180
- "@maplibre/maplibre-gl-style-spec": "^26.11.0",
181
- "@turf/helpers": "^7.4.0",
182
- "@turf/turf": "^7.4.0",
183
- "@types/geojson": "^7946.0.16",
184
- "@types/google.maps": "^3.67.0",
185
- "@types/leaflet": "^1.9.23",
186
- "c8": "^12.0.0",
187
- "esbuild": "^0.28.2",
188
- "fast-check": "^4.11.0",
189
- "jsdom": "^29.1.1",
190
- "leaflet": "^1.9.4",
191
- "leaflet-2": "npm:leaflet@^2.0.0-beta.5",
192
- "mapbox-gl": "^3.36.0",
193
- "maplibre-gl": "^6.19.0",
194
- "ol": "^10.11.0",
195
- "playwright-core": "^1.65.1",
196
- "tinybench": "^6.2.5",
197
- "typescript": "^7.0.2",
198
- "wabt": "^1.0.39"
199
- }
200
- }
1
+ {
2
+ "name": "@duoquote/polytini",
3
+ "version": "0.1.1",
4
+ "description": "Encode and decode Google encoded polylines. Small, strict by default, with fast paths for Node, Bun and Deno.",
5
+ "keywords": [
6
+ "polyline",
7
+ "encoded polyline",
8
+ "google maps",
9
+ "geojson",
10
+ "osrm",
11
+ "valhalla",
12
+ "leaflet",
13
+ "turf"
14
+ ],
15
+ "license": "MIT",
16
+ "author": "Güven Değirmenci",
17
+ "homepage": "https://github.com/Duoquote/polytini#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Duoquote/polytini.git"
21
+ },
22
+ "bugs": "https://github.com/Duoquote/polytini/issues",
23
+ "type": "module",
24
+ "sideEffects": [
25
+ "./src/leaflet-auto.js",
26
+ "./dist/leaflet-auto.cjs"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "browser": {
31
+ "types": "./types/index.d.ts",
32
+ "default": "./src/browser.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/types/index.d.cts",
36
+ "default": "./dist/node.cjs"
37
+ },
38
+ "types": "./types/index.d.ts",
39
+ "bun": "./src/bun.js",
40
+ "deno": "./src/deno.js",
41
+ "node": "./src/node.js",
42
+ "default": "./src/web.js"
43
+ },
44
+ "./web": {
45
+ "require": {
46
+ "types": "./dist/types/index.d.cts",
47
+ "default": "./dist/web.cjs"
48
+ },
49
+ "types": "./types/index.d.ts",
50
+ "default": "./src/web.js"
51
+ },
52
+ "./node": {
53
+ "require": {
54
+ "types": "./dist/types/index.d.cts",
55
+ "default": "./dist/node.cjs"
56
+ },
57
+ "types": "./types/index.d.ts",
58
+ "default": "./src/node.js"
59
+ },
60
+ "./browser": {
61
+ "types": "./types/index.d.ts",
62
+ "default": "./src/browser.js"
63
+ },
64
+ "./wasm": {
65
+ "types": "./types/wasm.d.ts",
66
+ "default": "./src/wasm.js"
67
+ },
68
+ "./turf": {
69
+ "require": {
70
+ "types": "./dist/types/turf.d.cts",
71
+ "default": "./dist/turf.cjs"
72
+ },
73
+ "types": "./types/turf.d.ts",
74
+ "default": "./src/turf.js"
75
+ },
76
+ "./leaflet": {
77
+ "require": {
78
+ "types": "./dist/types/leaflet.d.cts",
79
+ "default": "./dist/leaflet.cjs"
80
+ },
81
+ "types": "./types/leaflet.d.ts",
82
+ "default": "./src/leaflet.js"
83
+ },
84
+ "./presets": {
85
+ "require": {
86
+ "types": "./dist/types/presets.d.cts",
87
+ "default": "./dist/presets.cjs"
88
+ },
89
+ "types": "./types/presets.d.ts",
90
+ "default": "./src/presets.js"
91
+ },
92
+ "./flexible": {
93
+ "require": {
94
+ "types": "./dist/types/flexible.d.cts",
95
+ "default": "./dist/flexible.cjs"
96
+ },
97
+ "types": "./types/flexible.d.ts",
98
+ "default": "./src/flexible.js"
99
+ },
100
+ "./google": {
101
+ "require": {
102
+ "types": "./dist/types/google.d.cts",
103
+ "default": "./dist/google.cjs"
104
+ },
105
+ "types": "./types/google.d.ts",
106
+ "default": "./src/google.js"
107
+ },
108
+ "./maplibre": {
109
+ "require": {
110
+ "types": "./dist/types/maplibre.d.cts",
111
+ "default": "./dist/maplibre.cjs"
112
+ },
113
+ "types": "./types/maplibre.d.ts",
114
+ "default": "./src/maplibre.js"
115
+ },
116
+ "./mapbox": {
117
+ "require": {
118
+ "types": "./dist/types/mapbox.d.cts",
119
+ "default": "./dist/mapbox.cjs"
120
+ },
121
+ "types": "./types/mapbox.d.ts",
122
+ "default": "./src/mapbox.js"
123
+ },
124
+ "./deckgl": {
125
+ "require": {
126
+ "types": "./dist/types/deckgl.d.cts",
127
+ "default": "./dist/deckgl.cjs"
128
+ },
129
+ "types": "./types/deckgl.d.ts",
130
+ "default": "./src/deckgl.js"
131
+ },
132
+ "./leaflet/auto": {
133
+ "require": {
134
+ "types": "./dist/types/leaflet-auto.d.cts",
135
+ "default": "./dist/leaflet-auto.cjs"
136
+ },
137
+ "types": "./types/leaflet-auto.d.ts",
138
+ "default": "./src/leaflet-auto.js"
139
+ },
140
+ "./openlayers": {
141
+ "types": "./types/openlayers.d.ts",
142
+ "default": "./src/openlayers.js"
143
+ },
144
+ "./package.json": "./package.json"
145
+ },
146
+ "types": "./types/index.d.ts",
147
+ "main": "./dist/node.cjs",
148
+ "bin": {
149
+ "polytini": "src/cli.js"
150
+ },
151
+ "files": [
152
+ "src",
153
+ "types",
154
+ "dist",
155
+ "wasm/polytini.wasm"
156
+ ],
157
+ "engines": {
158
+ "node": ">=22"
159
+ },
160
+ "publishConfig": {
161
+ "access": "public"
162
+ },
163
+ "scripts": {
164
+ "build": "node scripts/build.js",
165
+ "build:wasm": "node scripts/build-wasm.js",
166
+ "prepack": "node scripts/build.js",
167
+ "test": "node test/run.js",
168
+ "test:bun": "bun test/run.js",
169
+ "test:deno": "deno run --allow-read --allow-env --allow-run --allow-write test/run.js",
170
+ "test:browser": "node test/browser.js",
171
+ "size": "node scripts/size.js",
172
+ "smoke": "node test/smoke.js",
173
+ "check:deps": "node scripts/check-deps.js"
174
+ },
175
+ "devDependencies": {
176
+ "@deck.gl/core": "^9.4.2",
177
+ "@deck.gl/geo-layers": "^9.4.2",
178
+ "@deck.gl/layers": "^9.4.2",
179
+ "@here/flexpolyline": "^0.1.0",
180
+ "@maplibre/maplibre-gl-style-spec": "^26.11.0",
181
+ "@turf/helpers": "^7.4.0",
182
+ "@turf/turf": "^7.4.0",
183
+ "@types/geojson": "^7946.0.16",
184
+ "@types/google.maps": "^3.67.0",
185
+ "@types/leaflet": "^1.9.23",
186
+ "c8": "^12.0.0",
187
+ "esbuild": "^0.28.2",
188
+ "fast-check": "^4.11.0",
189
+ "jsdom": "^29.1.1",
190
+ "leaflet": "^1.9.4",
191
+ "leaflet-2": "npm:leaflet@^2.0.0-beta.5",
192
+ "mapbox-gl": "^3.36.0",
193
+ "maplibre-gl": "^6.19.0",
194
+ "ol": "^10.11.0",
195
+ "playwright-core": "^1.65.1",
196
+ "tinybench": "^6.2.5",
197
+ "typescript": "^7.0.2",
198
+ "wabt": "^1.0.39"
199
+ }
200
+ }
package/src/browser.js CHANGED
@@ -1,15 +1,15 @@
1
- // Browser entry (the "browser" export condition): the portable core, except
2
- // that long lines encode through TextDecoder (text.js). In headless Chrome
3
- // that was about 50% faster from 1,000 points up and the same below 512,
4
- // where it falls back to the core. Decoding stays on the core's charCodeAt
5
- // loop: TextEncoder.encodeInto made it slower in Chrome. No Node, Bun or
6
- // Deno globals.
7
- /* @ts-self-types="../types/index.d.ts" */
8
- import { decode, latLngs, toGeo, fromGeo } from './core.js';
9
- import { encode } from './text.js';
10
-
11
- export { decode, decodeFlat, PolylineError } from './core.js';
12
- export { encode, encodeFlat } from './text.js';
13
- export const decodeLatLng = /* @__PURE__ */ latLngs(decode);
14
- export const toGeoJSON = /* @__PURE__ */ toGeo(decode);
15
- export const fromGeoJSON = /* @__PURE__ */ fromGeo(encode);
1
+ // Browser entry (the "browser" export condition): the portable core, except
2
+ // that long lines encode through TextDecoder (text.js). In headless Chrome
3
+ // that was about 50% faster from 1,000 points up and the same below 512,
4
+ // where it falls back to the core. Decoding stays on the core's charCodeAt
5
+ // loop: TextEncoder.encodeInto made it slower in Chrome. No Node, Bun or
6
+ // Deno globals.
7
+ /* @ts-self-types="../types/index.d.ts" */
8
+ import { decode, latLngs, toGeo, fromGeo } from './core.js';
9
+ import { encode } from './text.js';
10
+
11
+ export { decode, decodeFlat, PolylineError } from './core.js';
12
+ export { encode, encodeFlat } from './text.js';
13
+ export const decodeLatLng = /* @__PURE__ */ latLngs(decode);
14
+ export const toGeoJSON = /* @__PURE__ */ toGeo(decode);
15
+ export const fromGeoJSON = /* @__PURE__ */ fromGeo(encode);
package/src/bun.js CHANGED
@@ -1,4 +1,4 @@
1
- // Bun entry. The same Buffer fast paths as Node measured fastest on
2
- // JavaScriptCore too, so this is the Node entry under the bun condition.
3
- /* @ts-self-types="../types/index.d.ts" */
4
- export * from './node.js';
1
+ // Bun entry. The same Buffer fast paths as Node measured fastest on
2
+ // JavaScriptCore too, so this is the Node entry under the bun condition.
3
+ /* @ts-self-types="../types/index.d.ts" */
4
+ export * from './node.js';