diff --git a/package.json b/package.json index fe69b1d..55654a7 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,15 @@ "name": "maplibre-contour", "version": "0.0.7", "description": "Render contour lines from raster elevation tiles in maplibre-gl-js", - "browser": "dist/index.min.js", "unpkg": "dist/index.min.js", "main": "dist/index.cjs", "module": "dist/index.mjs", "types": "dist/index.d.ts", "exports": { "module": "./dist/index.mjs", - "require": "./dist/index.cjs" + "require": "./dist/index.cjs", + "types": "./dist/index.d.ts", + "browser": "./dist/index.min.js" }, "scripts": { "bench": "npm run build && node benchmark.js", diff --git a/src/actor.ts b/src/actor.ts index 9a55e4f..7254722 100644 --- a/src/actor.ts +++ b/src/actor.ts @@ -1,5 +1,5 @@ import { Timer } from "./performance"; -import { IsTransferrable, Timing } from "./types"; +import type { IsTransferrable, Timing } from "./types"; import { onAbort, withTimeout } from "./utils"; let id = 0; diff --git a/src/decode-image.ts b/src/decode-image.ts index 44552f4..48c245f 100644 --- a/src/decode-image.ts +++ b/src/decode-image.ts @@ -6,7 +6,7 @@ import { shouldUseVideoFrame, } from "./utils"; import type { MainThreadDispatch } from "./remote-dem-manager"; -import { DemTile, Encoding } from "./types"; +import type { DemTile, Encoding } from "./types"; let offscreenCanvas: OffscreenCanvas; let offscreenContext: OffscreenCanvasRenderingContext2D | null; diff --git a/src/dem-manager.ts b/src/dem-manager.ts index b3e2196..3aa97ca 100644 --- a/src/dem-manager.ts +++ b/src/dem-manager.ts @@ -3,7 +3,7 @@ import decodeImage from "./decode-image"; import { HeightTile } from "./height-tile"; import generateIsolines from "./isolines"; import { encodeIndividualOptions, isAborted, withTimeout } from "./utils"; -import { +import type { ContourTile, DemTile, Encoding, diff --git a/src/dem-source.ts b/src/dem-source.ts index aed0fef..dfe9d73 100644 --- a/src/dem-source.ts +++ b/src/dem-source.ts @@ -1,7 +1,8 @@ -import { DemManager, LocalDemManager } from "./dem-manager"; +import type { DemManager } from "./dem-manager"; +import { LocalDemManager } from "./dem-manager"; import { decodeOptions, encodeOptions, getOptionsForZoom } from "./utils"; import RemoteDemManager from "./remote-dem-manager"; -import { DemTile, GlobalContourTileOptions, Timing } from "./types"; +import type { DemTile, GlobalContourTileOptions, Timing } from "./types"; import type WorkerDispatch from "./worker-dispatch"; import Actor from "./actor"; import { Timer } from "./performance"; diff --git a/src/e2e.test.ts b/src/e2e.test.ts index f194574..5ad3fa5 100644 --- a/src/e2e.test.ts +++ b/src/e2e.test.ts @@ -3,7 +3,7 @@ import Actor from "./actor"; import WorkerDispatch from "./worker-dispatch"; import { DemSource } from "./dem-source"; import { MainThreadDispatch } from "./remote-dem-manager"; -import { DemTile, Timing } from "./types"; +import type { DemTile, Timing } from "./types"; import { VectorTile } from "@mapbox/vector-tile"; import Pbf from "pbf"; diff --git a/src/height-tile.ts b/src/height-tile.ts index be87b0e..ec8944c 100644 --- a/src/height-tile.ts +++ b/src/height-tile.ts @@ -1,4 +1,4 @@ -import { DemTile } from "./types"; +import type { DemTile } from "./types"; const MIN_VALID_M = -12000; const MAX_VALID_M = 9000; diff --git a/src/performance.ts b/src/performance.ts index f7ace27..9d786d1 100644 --- a/src/performance.ts +++ b/src/performance.ts @@ -1,4 +1,4 @@ -import { Timing, TimingCategory } from "./types"; +import type { Timing, TimingCategory } from "./types"; export const perf = typeof performance !== "undefined" ? performance : undefined; diff --git a/src/remote-dem-manager.ts b/src/remote-dem-manager.ts index fd7eb71..4811758 100644 --- a/src/remote-dem-manager.ts +++ b/src/remote-dem-manager.ts @@ -4,7 +4,7 @@ import type WorkerDispatch from "./worker-dispatch"; import decodeImage from "./decode-image"; import type { DemManager } from "./dem-manager"; import { Timer } from "./performance"; -import { +import type { ContourTile, DemTile, Encoding, diff --git a/src/utils.test.ts b/src/utils.test.ts index e8981ce..65eafbc 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -1,4 +1,4 @@ -import { +import type { GlobalContourTileOptions, IndividualContourTileOptions, } from "./types"; diff --git a/src/utils.ts b/src/utils.ts index dab5ef8..1df372b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import { +import type { ContourTile, DemTile, GlobalContourTileOptions, diff --git a/src/worker-dispatch.ts b/src/worker-dispatch.ts index 011eba1..4021f22 100644 --- a/src/worker-dispatch.ts +++ b/src/worker-dispatch.ts @@ -1,6 +1,6 @@ import { LocalDemManager } from "./dem-manager"; import { Timer } from "./performance"; -import { +import type { ContourTile, FetchResponse, IndividualContourTileOptions, diff --git a/test-project-maplibre-3/tsconfig.json b/test-project-maplibre-3/tsconfig.json index 3c43903..e6f83d5 100644 --- a/test-project-maplibre-3/tsconfig.json +++ b/test-project-maplibre-3/tsconfig.json @@ -1,3 +1,4 @@ { - "extends": "../tsconfig.json" + "extends": "../tsconfig.json", + "include": ["*.ts"] } diff --git a/test-project/tsconfig.json b/test-project/tsconfig.json index 3c43903..e6f83d5 100644 --- a/test-project/tsconfig.json +++ b/test-project/tsconfig.json @@ -1,3 +1,4 @@ { - "extends": "../tsconfig.json" + "extends": "../tsconfig.json", + "include": ["*.ts"] } diff --git a/tsconfig.json b/tsconfig.json index bb8ca2b..80543f7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,14 +3,15 @@ "target": "ES2016", "lib": ["ESNext", "DOM", "DOM.Iterable"], "strict": true, - "moduleResolution": "node", + "moduleResolution": "Bundler", "allowJs": true, "skipLibCheck": false, "types": ["jest", "node"], "allowSyntheticDefaultImports": true, "isolatedModules": true, "module": "ESNext", - "esModuleInterop": true + "esModuleInterop": true, + "verbatimModuleSyntax": true }, "ts-node": { "experimentalSpecifierResolution": "node",